예제 #1
0
  private CrossSectionPart commitPart(
      final Session session,
      final String dbType,
      final CrossSection crossSection,
      final GafPart part,
      final PDBNameGenerator nameGenerator)
      throws Exception {
    final CrossSectionPart csPart = new CrossSectionPart();

    final GafKind partKind = part.getKind();

    final String name = nameGenerator.createUniqueName(partKind.toString());

    csPart.setName(name);

    if (part.getKind() == GafKind.W) {
      final String gafFileName = m_profiles.getGafFilename();
      csPart.setDescription(
          String.format(Messages.getString("Gaf2Db.5"), gafFileName)); // $NON-NLS-1$
    } else csPart.setDescription(StringUtils.EMPTY);

    final CrossSectionPartType partType = findPartType(partKind);
    csPart.setCrossSectionPartType(partType);

    final Geometry line = part.getLine(dbType);
    csPart.setLine(line);

    csPart.setCrossSection(crossSection);
    session.save(csPart);
    return csPart;
  }
예제 #2
0
  private CrossSection commitCrossSection(
      final Session session, final String dbType, final GafProfile profile) throws Exception {
    final CrossSection crossSection = new CrossSection();

    final String protoName = String.format("%s", profile.getStation()); // $NON-NLS-1$

    final String name = m_sectionNameGenerator.createUniqueName(protoName);
    crossSection.setName(name);

    crossSection.setState(m_state);
    crossSection.setWaterBody(m_waterBody);

    crossSection.setDescription(StringUtils.EMPTY);

    crossSection.setStation(profile.getStation());

    /* Copy initial dates from state */
    crossSection.setCreationDate(m_state.getCreationDate());
    crossSection.setEditingDate(m_state.getEditingDate());
    crossSection.setEditingUser(m_state.getEditingUser());
    crossSection.setMeasurementDate(m_state.getMeasurementDate());

    final Geometry line = profile.createLine(dbType);
    crossSection.setLine(line);

    session.save(crossSection);

    return crossSection;
  }
예제 #3
0
  private void commitPoint(
      final GafPart gafPart,
      final Session session,
      final CrossSectionPart csPart,
      final GafPoint gafPoint,
      final int index,
      final PDBNameGenerator nameGenerator,
      final GafPart projectionPart) {
    final Point point = new Point();

    point.setCrossSectionPart(csPart);

    final GafCode code = gafPoint.getCode();
    final GafCode hyk = gafPoint.getHyk();

    /* Using pointID from gaf, but force it to be unique within each part */
    final String name = nameGenerator.createUniqueName(gafPoint.getPointId());

    final com.vividsolutions.jts.geom.Point location = gafPoint.getPoint();
    final BigDecimal width = getOrCalculatePoint(gafPart, gafPoint, projectionPart);

    /* Write data into db point */
    point.setName(name);

    point.setDescription(StringUtils.EMPTY);

    point.setConsecutiveNum(index);
    point.setHeight(gafPoint.getHeight());
    point.setWidth(width);
    point.setHyk(hyk.getHyk());
    point.setCode(code.getCode());

    point.setLocation(location);

    final Roughness roughness = gafPoint.getRoughnessClass();
    point.setRoughness(roughness);
    // REMARK: we do not resolve the values here, because a set values means 'overwritten'
    // point.setRoughnessKstValue( roughness.getKstValue() );
    // point.setRoughnessKValue( roughness.getKValue() );

    final Vegetation vegetation = gafPoint.getVegetationClass();
    if (vegetation == null) {
      System.out.println();
    }

    point.setVegetation(vegetation);
    // REMARK: we do not resolve the values here, because a set values means 'overwritten'
    // point.setVegetationAx( vegetation.getAx() );
    // point.setVegetationAy( vegetation.getAy() );
    // point.setVegetationDp( vegetation.getDp() );

    session.save(point);
  }