コード例 #1
0
  @Override
  public SimpleFeature addFeature(Geometry geometry) {
    org.sola.clients.beans.cadastre.CadastreObjectBean formBean =
        new org.sola.clients.beans.cadastre.CadastreObjectBean();
    formBean.setNameFirstpart(getLayer().getLastPart());
    formBean.setNameLastpart(getLayer().getNameFirstPart());
    if (geometry != null) {
      formBean.setOfficialAreaSize(new BigDecimal(geometry.getArea()));
      formBean.setCalculatedArea(new BigDecimal(geometry.getArea()));
    }
    ParcelDialog form = new ParcelDialog(formBean, false, null, true);

    final CadastreObjectBean[] beans = new CadastreObjectBean[1];

    // AM - Multi-SRID change
    // Need to explicitly set the SRID of the map on the geometry.
    final Geometry geom = this.layer.setSridOnGeometry(geometry);

    form.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(ParcelDialog.SELECTED_PARCEL)) {
              // Convert between CadastreObject in the GIS project and CadastreObject in the Clients
              // Beans
              org.sola.clients.beans.cadastre.CadastreObjectBean bean =
                  (org.sola.clients.beans.cadastre.CadastreObjectBean) evt.getNewValue();
              CadastreObjectBean bean2 =
                  MappingManager.getMapper().map(bean, CadastreObjectBean.class);
              // Fix problem with list area list duplications
              bean2.getSpatialValueAreaList().clear();
              bean2.getSpatialValueAreaList().addAll(bean.getSpatialValueAreaList());

              bean2.setFeatureGeom(geom);
              getLayer().getBeanList().add(bean2);
              beans[0] = bean2;
            }
          }
        });

    form.setVisible(true);
    if (beans[0] != null) {
      return getLayer().getFeatureByCadastreObjectId(beans[0].getId());
    }
    return null;
  }
コード例 #2
0
 public String getPropertyIdCode() {
   return CadastreObjectBean.getPropertyIdCode(getNameFirstPart(), getNameLastPart());
 }