Search in sources :

Example 1 with MultiSolidType

use of org.geotoolkit.gml.xml.v321.MultiSolidType in project geotoolkit by Geomatys.

the class JAXPStreamFeatureWriter method setId.

/**
 * @param inc auto increment value, ids must be unique
 */
private void setId(AbstractGeometry gmlGeometry, String id) {
    if (gmlGeometry.getId() == null || gmlGeometry.getId().isEmpty()) {
        // do not override ids if they exist
        gmlGeometry.setId(id + (gidInc));
        gidInc++;
    }
    if (gmlGeometry instanceof MultiCurve) {
        for (CurveProperty po : ((MultiCurve) gmlGeometry).getCurveMember()) {
            final AbstractCurve child = po.getAbstractCurve();
            if (child instanceof AbstractGeometry) {
                setId((AbstractGeometry) child, id);
            }
        }
    } else if (gmlGeometry instanceof MultiSurface) {
        for (SurfaceProperty po : ((MultiSurface) gmlGeometry).getSurfaceMember()) {
            final AbstractSurface child = po.getAbstractSurface();
            if (child instanceof AbstractGeometry) {
                setId((AbstractGeometry) child, id);
            }
        }
    } else if (gmlGeometry instanceof MultiGeometryType) {
        for (GeometryPropertyType po : ((MultiGeometryType) gmlGeometry).getGeometryMember()) {
            final AbstractGeometryType child = po.getAbstractGeometry();
            if (child instanceof AbstractGeometry) {
                setId((AbstractGeometry) child, id);
            }
        }
    } else if (gmlGeometry instanceof MultiSolidType) {
        for (SolidPropertyType po : ((MultiSolidType) gmlGeometry).getSolidMember()) {
            final AbstractSolidType child = po.getAbstractSolid().getValue();
            if (child instanceof AbstractGeometry) {
                setId((AbstractGeometry) child, id);
            }
        }
    } else if (gmlGeometry instanceof MultiPointType) {
        for (PointPropertyType po : ((MultiPointType) gmlGeometry).getPointMember()) {
            final PointType child = po.getPoint();
            if (child instanceof AbstractGeometry) {
                setId((AbstractGeometry) child, id);
            }
        }
    }
}
Also used : AbstractGeometry(org.geotoolkit.gml.xml.AbstractGeometry) MultiSurface(org.geotoolkit.gml.xml.MultiSurface) AbstractGeometryType(org.geotoolkit.gml.xml.v321.AbstractGeometryType) MultiGeometryType(org.geotoolkit.gml.xml.v321.MultiGeometryType) MultiPointType(org.geotoolkit.gml.xml.v321.MultiPointType) AbstractSurface(org.geotoolkit.gml.xml.AbstractSurface) CurveProperty(org.geotoolkit.gml.xml.CurveProperty) AbstractSolidType(org.geotoolkit.gml.xml.v321.AbstractSolidType) MultiCurve(org.geotoolkit.gml.xml.MultiCurve) SurfaceProperty(org.geotoolkit.gml.xml.SurfaceProperty) SolidPropertyType(org.geotoolkit.gml.xml.v321.SolidPropertyType) PointType(org.geotoolkit.gml.xml.v321.PointType) MultiPointType(org.geotoolkit.gml.xml.v321.MultiPointType) AbstractCurve(org.geotoolkit.gml.xml.AbstractCurve) PointPropertyType(org.geotoolkit.gml.xml.v321.PointPropertyType) GeometryPropertyType(org.geotoolkit.gml.xml.v321.GeometryPropertyType) MultiSolidType(org.geotoolkit.gml.xml.v321.MultiSolidType)

Aggregations

AbstractCurve (org.geotoolkit.gml.xml.AbstractCurve)1 AbstractGeometry (org.geotoolkit.gml.xml.AbstractGeometry)1 AbstractSurface (org.geotoolkit.gml.xml.AbstractSurface)1 CurveProperty (org.geotoolkit.gml.xml.CurveProperty)1 MultiCurve (org.geotoolkit.gml.xml.MultiCurve)1 MultiSurface (org.geotoolkit.gml.xml.MultiSurface)1 SurfaceProperty (org.geotoolkit.gml.xml.SurfaceProperty)1 AbstractGeometryType (org.geotoolkit.gml.xml.v321.AbstractGeometryType)1 AbstractSolidType (org.geotoolkit.gml.xml.v321.AbstractSolidType)1 GeometryPropertyType (org.geotoolkit.gml.xml.v321.GeometryPropertyType)1 MultiGeometryType (org.geotoolkit.gml.xml.v321.MultiGeometryType)1 MultiPointType (org.geotoolkit.gml.xml.v321.MultiPointType)1 MultiSolidType (org.geotoolkit.gml.xml.v321.MultiSolidType)1 PointPropertyType (org.geotoolkit.gml.xml.v321.PointPropertyType)1 PointType (org.geotoolkit.gml.xml.v321.PointType)1 SolidPropertyType (org.geotoolkit.gml.xml.v321.SolidPropertyType)1