.gitattributes | ●●●●● patch | view | raw | blame | history | |
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexChainElement.java | ●●●●● patch | view | raw | blame | history | |
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/EllipseElement.java | ●●●●● patch | view | raw | blame | history | |
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java | ●●●●● patch | view | raw | blame | history | |
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java | ●●●●● patch | view | raw | blame | history | |
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateShapeStrategy.java | ●●●●● patch | view | raw | blame | history | |
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeneralDgnConvertJobContext.java | ●●●●● patch | view | raw | blame | history |
.gitattributes
@@ -45,6 +45,8 @@ xdgnjobs/ximple-spatialjob/pom.xml svneol=native#text/xml xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractDispatchableFilter.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractFLinkageDispatchableFilter.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateFeatureTypeStrategy.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineTextStrategy.java svneol=native#text/plain xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexChainElement.java
@@ -146,7 +146,7 @@ public Geometry toGeometry(GeometryFactory factory) { ArrayList list = new ArrayList(); ArrayList<Geometry> list = new ArrayList<Geometry>(); if (size() == 1) { @@ -195,14 +195,15 @@ { list.add(((LineElement) element).toGeometry(factory)); } } else if (element instanceof ArcElement) { list.add(((ArcElement) element).toGeometry(factory)); } } Geometry[] ga = (Geometry[]) list.toArray(new Geometry[list.size()]); GeometryCollection geos = new GeometryCollection(ga, factory); Geometry[] ga = list.toArray(new Geometry[list.size()]); return geos; return new GeometryCollection(ga, factory); } public double getElementSize() xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/EllipseElement.java
@@ -114,7 +114,7 @@ double temp = Math.abs(getStartAngle() - getSweepAngle()); temp /= 4; int pts = (temp < 3) ? 3 : (int) temp; return factory.createLineString(convertToLineString(pts)); return factory.createPolygon(factory.createLinearRing(convertToLineString(pts)), null); } private Coordinate[] convertToLineString(int pts) xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java
New file @@ -0,0 +1,94 @@ package com.ximple.eofms.filter; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.geotools.feature.AttributeTypeFactory; import org.geotools.feature.Feature; import org.geotools.feature.FeatureType; import org.geotools.feature.FeatureTypeBuilder; import org.geotools.feature.IllegalAttributeException; import org.geotools.feature.SchemaException; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; import com.ximple.eofms.jobs.TWD97GeometryConverterDecorator; import com.ximple.eofms.util.DefaultColorTable; import com.ximple.io.dgn7.ArcElement; import com.ximple.io.dgn7.Element; import com.ximple.io.dgn7.FrammeAttributeData; import com.ximple.io.dgn7.UserAttributeData; public class CreateArcLineStringStrategy implements CreateFeatureTypeStrategy { static final Log logger = LogFactory.getLog(CreateLineStringStrategy.class); GeometryFactory geometryFactory = new GeometryFactory(); FeatureTypeBuilder typeBuilder = null; TWD97GeometryConverterDecorator convertDecorator = new TWD97GeometryConverterDecorator(); public CreateArcLineStringStrategy() { } protected FrammeAttributeData getFeatureLinkage(Element element) { if (!element.hasUserAttributeData()) return null; List<UserAttributeData> usrDatas = element.getUserAttributeData(); for (UserAttributeData anUsrData : usrDatas) { if (anUsrData instanceof FrammeAttributeData) { return (FrammeAttributeData) anUsrData; } } return null; } public FeatureType createFeatureElement(String featureName) throws SchemaException { if (typeBuilder == null) { typeBuilder = FeatureTypeBuilder.newInstance(featureName); typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); } return typeBuilder.getFeatureType(); } public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); FrammeAttributeData fLinkage = getFeatureLinkage(element); if (fLinkage == null) return null; if (element instanceof ArcElement) { ArcElement lineStringElement = (ArcElement) element; convertDecorator.setConverter(lineStringElement); Feature feature = featureType.create(new Object[]{ convertDecorator.toGeometry(geometryFactory), (int) fLinkage.getFsc(), (long) fLinkage.getUfid(), (int) fLinkage.getComponentID(), 0, lineStringElement.getLevelIndex(), colorTable.getColorCode(lineStringElement.getColorIndex()), lineStringElement.getWeight(), lineStringElement.getLineStyle() }); return feature; } return null; } } xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java
New file @@ -0,0 +1,95 @@ package com.ximple.eofms.filter; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.geotools.feature.AttributeTypeFactory; import org.geotools.feature.Feature; import org.geotools.feature.FeatureType; import org.geotools.feature.FeatureTypeBuilder; import org.geotools.feature.IllegalAttributeException; import org.geotools.feature.SchemaException; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; import com.ximple.eofms.jobs.TWD97GeometryConverterDecorator; import com.ximple.eofms.util.DefaultColorTable; import com.ximple.io.dgn7.Element; import com.ximple.io.dgn7.EllipseElement; import com.ximple.io.dgn7.FrammeAttributeData; import com.ximple.io.dgn7.UserAttributeData; public class CreateEllipseShapeStrategy implements CreateFeatureTypeStrategy { static final Log logger = LogFactory.getLog(CreateShapeStrategy.class); GeometryFactory geometryFactory = new GeometryFactory(); FeatureTypeBuilder typeBuilder = null; TWD97GeometryConverterDecorator convertDecorator = new TWD97GeometryConverterDecorator(); public CreateEllipseShapeStrategy() { } protected FrammeAttributeData getFeatureLinkage(Element element) { if (!element.hasUserAttributeData()) return null; List<UserAttributeData> usrDatas = element.getUserAttributeData(); for (UserAttributeData anUsrData : usrDatas) { if (anUsrData instanceof FrammeAttributeData) { return (FrammeAttributeData) anUsrData; } } return null; } public FeatureType createFeatureElement(String featureName) throws SchemaException { if (typeBuilder == null) { typeBuilder = FeatureTypeBuilder.newInstance(featureName); typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); } return typeBuilder.getFeatureType(); } public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); FrammeAttributeData fLinkage = getFeatureLinkage(element); if (fLinkage == null) return null; if (element instanceof EllipseElement) { EllipseElement shapeElement = (EllipseElement) element; convertDecorator.setConverter(shapeElement); Feature feature = featureType.create(new Object[]{ convertDecorator.toGeometry(geometryFactory), (int) fLinkage.getFsc(), (long) fLinkage.getUfid(), (int) fLinkage.getComponentID(), 0, shapeElement.getLevelIndex(), colorTable.getColorCode(shapeElement.getColorIndex()), shapeElement.getWeight(), shapeElement.getLineStyle() }); return feature; } return null; } } xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateShapeStrategy.java
@@ -108,4 +108,3 @@ return null; } } xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeneralDgnConvertJobContext.java
@@ -36,6 +36,8 @@ import com.ximple.io.dgn7.ShapeElement; import com.ximple.io.dgn7.TextElement; import com.ximple.io.dgn7.UserAttributeData; import com.ximple.io.dgn7.ArcElement; import com.ximple.io.dgn7.EllipseElement; public class GeneralDgnConvertJobContext extends AbstractDgnFileJobContext { @@ -82,6 +84,11 @@ logger.info("cannot craete feature." + element.toString() + "'" + ((LineStringElement) element).getVerticeSize() + "'" + ((LineStringElement) element).getStartPoint()); else if (element instanceof ArcElement) logger.info("cannot craete feature." + element.toString() + "'" + ((ArcElement) element).getOrigin().toString() + "'" + ((ArcElement) element).getRotationAngle()); return; } @@ -244,6 +251,19 @@ return typeBuilder.getFeatureType(); } public FeatureType createEllipseFeatureElement(String featureName) throws SchemaException { if (typeBuilder == null) { typeBuilder = FeatureTypeBuilder.newInstance(featureName); typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", String.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); } return typeBuilder.getFeatureType(); } public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); @@ -313,7 +333,6 @@ line.getLineStyle() }); return null; /* } else if (element instanceof ArcElement) { ArcElement arcElement = (ArcElement) element; @@ -327,7 +346,19 @@ arcElement.getLineStyle() }); return null; */ } else if (element instanceof EllipseElement) { EllipseElement arcElement = (EllipseElement) element; convertDecorator.setConverter(arcElement); Geometry geom = convertDecorator.toGeometry(geometryFactory); if (geom != null) return featureType.create(new Object[]{ geom, colorTable.getColorCode(arcElement.getColorIndex()), arcElement.getWeight(), arcElement.getLineStyle() }); return null; } return null; } @@ -382,7 +413,6 @@ featureTypes.put(typeName, createLineFeatureElement(typeName)); } return featureTypes.get(typeName); /* } else if (element instanceof ArcElement) { typeName = getFeatureBaseName() + "A"; @@ -391,7 +421,14 @@ featureTypes.put(typeName, createArcFeatureElement(typeName)); } return featureTypes.get(typeName); */ } else if (element instanceof EllipseElement) { typeName = getFeatureBaseName() + "R"; if (!featureTypes.containsKey(typeName)) { featureTypes.put(typeName, createEllipseFeatureElement(typeName)); } return featureTypes.get(typeName); } return null;