Revision 20421 trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dxf/DXFStore.java
DXFStore.java | ||
---|---|---|
44 | 44 |
import org.gvsig.data.vectorial.IFeatureCollection; |
45 | 45 |
import org.gvsig.data.vectorial.IFeatureID; |
46 | 46 |
import org.gvsig.data.vectorial.IFeatureType; |
47 |
import org.gvsig.data.vectorial.IsNotAttributeSettingException; |
|
47 | 48 |
import org.gvsig.data.vectorial.IsNotFeatureSettingException; |
48 | 49 |
import org.gvsig.data.vectorial.MemoryFeature; |
49 | 50 |
import org.gvsig.data.vectorial.filter.FeatureFilterParser; |
... | ... | |
112 | 113 |
static IFeatureType newFeatureType(){ |
113 | 114 |
DefaultFeatureType fType= new DefaultFeatureType(); |
114 | 115 |
|
116 |
try{ |
|
115 | 117 |
DefaultAttributeDescriptor descriptorID = new DefaultAttributeDescriptor(); |
118 |
descriptorID.loading(); |
|
116 | 119 |
descriptorID.setType(IFeatureAttributeDescriptor.TYPE_INT); |
117 | 120 |
descriptorID.setName("ID"); |
118 | 121 |
descriptorID.setDefaultValue(new Integer(0)); |
122 |
descriptorID.stopLoading(); |
|
119 | 123 |
fType.add(descriptorID); |
120 | 124 |
|
121 | 125 |
DefaultAttributeDescriptor descriptorShape = new DefaultAttributeDescriptor(); |
126 |
descriptorShape.loading(); |
|
122 | 127 |
descriptorShape.setType(IFeatureAttributeDescriptor.TYPE_GEOMETRY); |
123 | 128 |
descriptorShape.setName("GEOMETRY"); |
124 | 129 |
descriptorShape.setDefaultValue(null); |
130 |
descriptorShape.stopLoading(); |
|
125 | 131 |
fType.add(descriptorShape); |
126 | 132 |
fType.setDefaultGeometry("GEOMETRY"); |
127 | 133 |
|
128 | 134 |
DefaultAttributeDescriptor descriptorEntity = new DefaultAttributeDescriptor(); |
135 |
descriptorEntity.loading(); |
|
129 | 136 |
descriptorEntity.setType(IFeatureAttributeDescriptor.TYPE_STRING); |
130 | 137 |
descriptorEntity.setName("Entity"); |
131 | 138 |
descriptorEntity.setDefaultValue("Entity"); |
139 |
descriptorEntity.stopLoading(); |
|
132 | 140 |
fType.add(descriptorEntity); |
133 | 141 |
|
134 | 142 |
DefaultAttributeDescriptor descriptorLayer = new DefaultAttributeDescriptor(); |
143 |
descriptorLayer.loading(); |
|
135 | 144 |
descriptorLayer.setType(IFeatureAttributeDescriptor.TYPE_STRING); |
136 | 145 |
descriptorLayer.setName("Layer"); |
137 | 146 |
descriptorLayer.setDefaultValue("default"); |
147 |
descriptorLayer.stopLoading(); |
|
138 | 148 |
fType.add(descriptorLayer); |
139 | 149 |
|
140 | 150 |
DefaultAttributeDescriptor descriptorColor = new DefaultAttributeDescriptor(); |
151 |
descriptorColor.loading(); |
|
141 | 152 |
descriptorColor.setType(IFeatureAttributeDescriptor.TYPE_INT); |
142 | 153 |
descriptorColor.setName("Color"); |
143 | 154 |
descriptorColor.setDefaultValue(new Integer(0)); |
155 |
descriptorColor.stopLoading(); |
|
144 | 156 |
fType.add(descriptorColor); |
145 | 157 |
|
146 | 158 |
DefaultAttributeDescriptor descriptorElevation = new DefaultAttributeDescriptor(); |
159 |
descriptorElevation.loading(); |
|
147 | 160 |
descriptorElevation.setType(IFeatureAttributeDescriptor.TYPE_DOUBLE); |
148 | 161 |
descriptorElevation.setName("Elevation"); |
149 | 162 |
descriptorElevation.setDefaultValue(new Double(0)); |
163 |
descriptorElevation.stopLoading(); |
|
150 | 164 |
fType.add(descriptorElevation); |
151 | 165 |
|
152 | 166 |
DefaultAttributeDescriptor descriptorThickness = new DefaultAttributeDescriptor(); |
167 |
descriptorThickness.loading(); |
|
153 | 168 |
descriptorThickness.setType(IFeatureAttributeDescriptor.TYPE_DOUBLE); |
154 | 169 |
descriptorThickness.setName("Thickness"); |
155 | 170 |
descriptorThickness.setDefaultValue(new Double(0)); |
171 |
descriptorThickness.stopLoading(); |
|
156 | 172 |
fType.add(descriptorThickness); |
157 | 173 |
|
158 | 174 |
DefaultAttributeDescriptor descriptorText = new DefaultAttributeDescriptor(); |
175 |
descriptorText.loading(); |
|
159 | 176 |
descriptorText.setType(IFeatureAttributeDescriptor.TYPE_STRING); |
160 | 177 |
descriptorText.setName("Text"); |
161 | 178 |
descriptorText.setDefaultValue(""); |
179 |
descriptorText.stopLoading(); |
|
162 | 180 |
fType.add(descriptorText); |
163 | 181 |
|
164 | 182 |
DefaultAttributeDescriptor descriptorHeightText = new DefaultAttributeDescriptor(); |
183 |
descriptorHeightText.loading(); |
|
165 | 184 |
descriptorHeightText.setType(IFeatureAttributeDescriptor.TYPE_FLOAT); |
166 | 185 |
descriptorHeightText.setName("HeightText"); |
167 | 186 |
descriptorHeightText.setDefaultValue(new Float(10)); |
187 |
descriptorHeightText.stopLoading(); |
|
168 | 188 |
fType.add(descriptorHeightText); |
169 | 189 |
|
170 | 190 |
DefaultAttributeDescriptor descriptorRotationText = new DefaultAttributeDescriptor(); |
191 |
descriptorRotationText.loading(); |
|
171 | 192 |
descriptorRotationText.setType(IFeatureAttributeDescriptor.TYPE_DOUBLE); |
172 | 193 |
descriptorRotationText.setName("Rotation"); |
173 | 194 |
descriptorRotationText.setDefaultValue(new Double(10)); |
195 |
descriptorRotationText.stopLoading(); |
|
174 | 196 |
fType.add(descriptorRotationText); |
197 |
}catch (IsNotAttributeSettingException e) { |
|
198 |
e.printStackTrace(); |
|
199 |
} |
|
175 | 200 |
|
176 |
|
|
177 | 201 |
return fType; |
178 | 202 |
|
179 | 203 |
} |
... | ... | |
182 | 206 |
featureType= newFeatureType(); |
183 | 207 |
} |
184 | 208 |
|
185 |
protected void doFinishEdition() throws WriteException, ReadException, IsNotFeatureSettingException {
|
|
209 |
protected void doFinishEdition() throws WriteException, ReadException { |
|
186 | 210 |
IFeaturesWriter writer = getFeaturesWriter(); |
187 | 211 |
writer.init(this); |
188 | 212 |
writer.updateFeatureType(featureType); |
... | ... | |
198 | 222 |
|
199 | 223 |
} |
200 | 224 |
|
201 |
public IDataCollection getDataCollection(IFeatureType type, String filter, String order) throws ReadException, IsNotFeatureSettingException {
|
|
225 |
public IDataCollection getDataCollection(IFeatureType type, String filter, String order) throws ReadException { |
|
202 | 226 |
if (type==null){ |
203 | 227 |
type=getDefaultFeatureType(); |
204 | 228 |
} |
... | ... | |
259 | 283 |
|
260 | 284 |
} |
261 | 285 |
|
262 |
public IFeature getFeatureByID(IFeatureID id) throws ReadException, NumberFormatException, IsNotFeatureSettingException {
|
|
286 |
public IFeature getFeatureByID(IFeatureID id) throws ReadException { |
|
263 | 287 |
if (this.alterMode){ |
264 | 288 |
if (featureManager.contains(id)) { |
265 | 289 |
return featureManager.getFeature(id); |
... | ... | |
302 | 326 |
return DATASTORE_NAME; |
303 | 327 |
} |
304 | 328 |
|
305 |
public void open() throws OpenException, IsNotFeatureSettingException {
|
|
329 |
public void open() throws OpenException { |
|
306 | 330 |
this.observable.notifyObservers( |
307 | 331 |
new FeatureStoreNotification(this,FeatureStoreNotification.BEFORE_OPEN) |
308 | 332 |
); |
... | ... | |
403 | 427 |
att = (String[]) featureMaker.getAttributes().get(i); |
404 | 428 |
|
405 | 429 |
DefaultAttributeDescriptor descriptorAux = new DefaultAttributeDescriptor(); |
406 |
descriptorAux.setType(IFeatureAttributeDescriptor.TYPE_STRING); |
|
407 |
descriptorAux.setName(att[0]); |
|
408 |
descriptorAux.setDefaultValue(""); |
|
430 |
try { |
|
431 |
descriptorAux.loading(); |
|
432 |
descriptorAux.setType(IFeatureAttributeDescriptor.TYPE_STRING); |
|
433 |
descriptorAux.setName(att[0]); |
|
434 |
descriptorAux.setDefaultValue(""); |
|
435 |
descriptorAux.stopLoading(); |
|
436 |
} catch (IsNotAttributeSettingException e) { |
|
437 |
e.printStackTrace(); |
|
438 |
} |
|
409 | 439 |
featureType.add(descriptorAux); |
410 | 440 |
|
411 | 441 |
|
... | ... | |
426 | 456 |
// auxRow[ID_FIELD_HEIGHTTEXT] = new Double(0.0); |
427 | 457 |
// auxRow[ID_FIELD_ROTATIONTEXT] = new Double(0.0); |
428 | 458 |
// auxRow[ID_FIELD_TEXT] = null; |
429 |
feature.loading(); |
|
430 |
Feature fea = (Feature) features.get(i); |
|
431 |
if (fea.getGeometry() instanceof Point |
|
432 |
&& !(fea.getGeometry() instanceof org.cresques.px.gml.Point3D)) { |
|
433 |
Point point = (Point) fea.getGeometry(); |
|
434 |
Point2D pto = new Point2D.Double(); |
|
435 |
pto = point.get(0); |
|
436 |
FShape nuevoShp; |
|
437 |
if (point.isTextPoint()) { |
|
459 |
try{ |
|
460 |
feature.loading(); |
|
461 |
Feature fea = (Feature) features.get(i); |
|
462 |
if (fea.getGeometry() instanceof Point |
|
463 |
&& !(fea.getGeometry() instanceof org.cresques.px.gml.Point3D)) { |
|
464 |
Point point = (Point) fea.getGeometry(); |
|
465 |
Point2D pto = new Point2D.Double(); |
|
466 |
pto = point.get(0); |
|
467 |
FShape nuevoShp; |
|
468 |
if (point.isTextPoint()) { |
|
469 |
feature.set(ID_FIELD_ID,i); |
|
470 |
// auxRow[ID_FIELD_ID] = new Integer(i); |
|
471 |
// feature.set(ID_FIELD_FSHAPE,"Point2D"); |
|
472 |
// auxRow[ID_FIELD_FSHAPE] = new String("FPoint2D"); |
|
473 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
|
474 |
// auxRow[ID_FIELD_ENTITY] = new String(fea.getProp("dxfEntity")); |
|
475 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
|
476 |
// auxRow[ID_FIELD_LAYER] = new String(fea.getProp("layer")); |
|
477 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
478 |
feature.set(ID_FIELD_COLOR,auxInt); |
|
479 |
// auxRow[ID_FIELD_COLOR] = new Integer(auxInt); |
|
480 |
feature.set(ID_FIELD_TEXT,fea.getProp("text")); |
|
481 |
// auxRow[ID_FIELD_TEXT] = ValueFactory |
|
482 |
// .createValue(new String(fea.getProp("text"))); |
|
483 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
484 |
feature.set(ID_FIELD_HEIGHTTEXT,heightText); |
|
485 |
// auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory |
|
486 |
// .createValue(heightText); |
|
487 |
double auxR = Double.parseDouble(fea |
|
488 |
.getProp("textRotation")); |
|
489 |
feature.set(ID_FIELD_ROTATIONTEXT,auxR); |
|
490 |
// auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory |
|
491 |
// .createValue(auxR); |
|
492 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
493 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
494 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
495 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
496 |
feature.set(ID_FIELD_THICKNESS,auxT); |
|
497 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
498 |
// Attributes |
|
499 |
for (int j = 0; j < nAtt; j++) { |
|
500 |
String[] attributes = new String[2]; |
|
501 |
attributes = (String[]) featureMaker.getAttributes() |
|
502 |
.get(j); |
|
503 |
feature.set(10+j,attributes[1]); |
|
504 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
505 |
// attributes[1])); |
|
506 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
507 |
feature.set(10+j,fea.getProp(attributes[0])); |
|
508 |
// auxRow[10 + j] = ValueFactory |
|
509 |
// .createValue(new String(fea |
|
510 |
// .getProp(attributes[0]))); |
|
511 |
} |
|
512 |
} |
|
513 |
IGeometry geom=ShapeFactory.createPoint2D(new FPoint2D(pto.getX(), pto.getY())); |
|
514 |
feature.set(ID_FIELD_FSHAPE,geom); |
|
515 |
// feature.setDefaultGeometry(geom); |
|
516 |
addFeature(feature); |
|
517 |
|
|
518 |
// addShape(nuevoShp, auxRow); |
|
519 |
} else { |
|
520 |
feature.set(ID_FIELD_ID,i); |
|
521 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
522 |
// feature.set(ID_FIELD_FSHAPE,"Point2D"); |
|
523 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
524 |
// .createValue(new String("FPoint2D")); |
|
525 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
|
526 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
527 |
// .createValue(new String(fea.getProp("dxfEntity"))); |
|
528 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
|
529 |
// auxRow[ID_FIELD_LAYER] = ValueFactory |
|
530 |
// .createValue(new String(fea.getProp("layer"))); |
|
531 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
532 |
feature.set(ID_FIELD_COLOR,auxInt); |
|
533 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
534 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
535 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
536 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
537 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
538 |
feature.set(ID_FIELD_THICKNESS,auxT); |
|
539 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
540 |
// Attributes |
|
541 |
for (int j = 0; j < nAtt; j++) { |
|
542 |
String[] attributes = new String[2]; |
|
543 |
attributes = (String[]) featureMaker.getAttributes() |
|
544 |
.get(j); |
|
545 |
feature.set(10+j,attributes[1]); |
|
546 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
547 |
// attributes[1])); |
|
548 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
549 |
feature.set(10+j,fea.getProp(attributes[0])); |
|
550 |
// auxRow[10 + j] = ValueFactory |
|
551 |
// .createValue(new String(fea |
|
552 |
// .getProp(attributes[0]))); |
|
553 |
} |
|
554 |
} |
|
555 |
IGeometry geom=ShapeFactory.createPoint2D(new FPoint2D(pto.getX(), pto.getY())); |
|
556 |
feature.set(ID_FIELD_FSHAPE,geom); |
|
557 |
// feature.setDefaultGeometry(geom); |
|
558 |
addFeature(feature); |
|
559 |
// addShape(nuevoShp, auxRow); |
|
560 |
} |
|
561 |
} else if (fea.getGeometry() instanceof org.cresques.px.gml.Point3D) { |
|
562 |
org.cresques.px.gml.Point3D point = (org.cresques.px.gml.Point3D) fea |
|
563 |
.getGeometry(); |
|
564 |
Point3D pto = new Point3D(); |
|
565 |
pto = point.getPoint3D(0); |
|
566 |
FShape nuevoShp; |
|
567 |
if (point.isTextPoint()) { |
|
568 |
feature.set(ID_FIELD_ID,i); |
|
569 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
570 |
feature.set(ID_FIELD_FSHAPE,"Point3D"); |
|
571 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
572 |
// .createValue(new String("FPoint3D")); |
|
573 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
|
574 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
575 |
// .createValue(new String(fea.getProp("dxfEntity"))); |
|
576 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
|
577 |
// auxRow[ID_FIELD_LAYER] = ValueFactory |
|
578 |
// .createValue(new String(fea.getProp("layer"))); |
|
579 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
580 |
feature.set(ID_FIELD_COLOR,auxInt); |
|
581 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
582 |
feature.set(ID_FIELD_TEXT,fea.getProp("text")); |
|
583 |
// auxRow[ID_FIELD_TEXT] = ValueFactory |
|
584 |
// .createValue(new String(fea.getProp("text"))); |
|
585 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
586 |
feature.set(ID_FIELD_HEIGHTTEXT,heightText); |
|
587 |
// auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory |
|
588 |
// .createValue(heightText); |
|
589 |
double auxR = Double.parseDouble(fea |
|
590 |
.getProp("textRotation")); |
|
591 |
feature.set(ID_FIELD_ROTATIONTEXT,auxR); |
|
592 |
// auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory |
|
593 |
// .createValue(auxR); |
|
594 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
595 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
596 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
597 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
598 |
feature.set(ID_FIELD_THICKNESS,auxT); |
|
599 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
600 |
// Attributes |
|
601 |
for (int j = 0; j < nAtt; j++) { |
|
602 |
String[] attributes = new String[2]; |
|
603 |
attributes = (String[]) featureMaker.getAttributes() |
|
604 |
.get(j); |
|
605 |
feature.set(10+j,attributes[1]); |
|
606 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
607 |
// attributes[1])); |
|
608 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
609 |
feature.set(10+j,fea.getProp(attributes[0])); |
|
610 |
// auxRow[10 + j] = ValueFactory |
|
611 |
// .createValue(new String(fea |
|
612 |
// .getProp(attributes[0]))); |
|
613 |
} |
|
614 |
} |
|
615 |
IGeometry geom=ShapeFactory.createPoint3D(pto.getX(), pto.getY(), pto.getZ()); |
|
616 |
feature.set(ID_FIELD_FSHAPE,geom); |
|
617 |
// feature.setDefaultGeometry(geom); |
|
618 |
addFeature(feature); |
|
619 |
// addShape(nuevoShp, auxRow); |
|
620 |
} else { |
|
621 |
feature.set(ID_FIELD_ID,i); |
|
622 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
623 |
feature.set(ID_FIELD_FSHAPE,"Point3D"); |
|
624 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
625 |
// .createValue(new String("FPoint3D")); |
|
626 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
|
627 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
628 |
// .createValue(new String(fea.getProp("dxfEntity"))); |
|
629 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
|
630 |
// auxRow[ID_FIELD_LAYER] = ValueFactory |
|
631 |
// .createValue(new String(fea.getProp("layer"))); |
|
632 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
633 |
feature.set(ID_FIELD_COLOR,auxInt); |
|
634 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
635 |
|
|
636 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
637 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
638 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
639 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
640 |
feature.set(ID_FIELD_THICKNESS,auxT); |
|
641 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
642 |
// Attributes |
|
643 |
for (int j = 0; j < nAtt; j++) { |
|
644 |
String[] attributes = new String[2]; |
|
645 |
attributes = (String[]) featureMaker.getAttributes() |
|
646 |
.get(j); |
|
647 |
feature.set(10+j,attributes[1]); |
|
648 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
649 |
// attributes[1])); |
|
650 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
651 |
feature.set(10+j,fea.getProp(attributes[0])); |
|
652 |
// auxRow[10 + j] = ValueFactory |
|
653 |
// .createValue(new String(fea |
|
654 |
// .getProp(attributes[0]))); |
|
655 |
} |
|
656 |
} |
|
657 |
IGeometry geom=ShapeFactory.createPoint3D(pto.getX(), pto.getY(), pto.getZ()); |
|
658 |
feature.set(ID_FIELD_FSHAPE,geom); |
|
659 |
// feature.setDefaultGeometry(geom); |
|
660 |
addFeature(feature); |
|
661 |
// addShape(nuevoShp, auxRow); |
|
662 |
} |
|
663 |
} else if (fea.getGeometry() instanceof LineString |
|
664 |
&& !(fea.getGeometry() instanceof LineString3D)) { |
|
665 |
GeneralPathX genPathX = new GeneralPathX(); |
|
666 |
Point2D[] pts = new Point2D[fea.getGeometry().pointNr()]; |
|
667 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
668 |
pts[j] = fea.getGeometry().get(j); |
|
669 |
} |
|
670 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
671 |
for (int j = 1; j < pts.length; j++) { |
|
672 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
673 |
} |
|
438 | 674 |
feature.set(ID_FIELD_ID,i); |
439 |
// auxRow[ID_FIELD_ID] = new Integer(i); |
|
440 |
// feature.set(ID_FIELD_FSHAPE,"Point2D"); |
|
441 |
// auxRow[ID_FIELD_FSHAPE] = new String("FPoint2D"); |
|
675 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
676 |
feature.set(ID_FIELD_FSHAPE,"Polyline2D"); |
|
677 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
678 |
// "FPolyline2D")); |
|
442 | 679 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
443 |
// auxRow[ID_FIELD_ENTITY] = new String(fea.getProp("dxfEntity")); |
|
680 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
681 |
// fea.getProp("dxfEntity"))); |
|
444 | 682 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
445 |
// auxRow[ID_FIELD_LAYER] = new String(fea.getProp("layer")); |
|
683 |
// auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
684 |
// fea.getProp("layer"))); |
|
446 | 685 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
447 | 686 |
feature.set(ID_FIELD_COLOR,auxInt); |
448 |
// auxRow[ID_FIELD_COLOR] = new Integer(auxInt); |
|
449 |
feature.set(ID_FIELD_TEXT,fea.getProp("text")); |
|
450 |
// auxRow[ID_FIELD_TEXT] = ValueFactory |
|
451 |
// .createValue(new String(fea.getProp("text"))); |
|
452 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
453 |
feature.set(ID_FIELD_HEIGHTTEXT,heightText); |
|
454 |
// auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory |
|
455 |
// .createValue(heightText); |
|
456 |
double auxR = Double.parseDouble(fea |
|
457 |
.getProp("textRotation")); |
|
458 |
feature.set(ID_FIELD_ROTATIONTEXT,auxR); |
|
459 |
// auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory |
|
460 |
// .createValue(auxR); |
|
687 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
461 | 688 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
462 | 689 |
feature.set(ID_FIELD_ELEVATION,auxE); |
463 | 690 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
... | ... | |
467 | 694 |
// Attributes |
468 | 695 |
for (int j = 0; j < nAtt; j++) { |
469 | 696 |
String[] attributes = new String[2]; |
470 |
attributes = (String[]) featureMaker.getAttributes() |
|
471 |
.get(j); |
|
697 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
472 | 698 |
feature.set(10+j,attributes[1]); |
473 | 699 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
474 |
// attributes[1]));
|
|
700 |
// attributes[1])); |
|
475 | 701 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
476 | 702 |
feature.set(10+j,fea.getProp(attributes[0])); |
477 |
// auxRow[10 + j] = ValueFactory |
|
478 |
// .createValue(new String(fea |
|
479 |
// .getProp(attributes[0]))); |
|
703 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
704 |
// fea.getProp(attributes[0]))); |
|
480 | 705 |
} |
481 | 706 |
} |
482 |
IGeometry geom=ShapeFactory.createPoint2D(new FPoint2D(pto.getX(), pto.getY()));
|
|
707 |
IGeometry geom=ShapeFactory.createPolyline2D(genPathX);
|
|
483 | 708 |
feature.set(ID_FIELD_FSHAPE,geom); |
484 | 709 |
// feature.setDefaultGeometry(geom); |
485 | 710 |
addFeature(feature); |
486 |
|
|
487 | 711 |
// addShape(nuevoShp, auxRow); |
488 |
} else { |
|
712 |
} else if (fea.getGeometry() instanceof LineString3D) { |
|
713 |
GeneralPathX genPathX = new GeneralPathX(); |
|
714 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr()]; |
|
715 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
716 |
pts[j] = ((LineString3D) fea.getGeometry()).getPoint3D(j); |
|
717 |
} |
|
718 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
719 |
for (int j = 1; j < pts.length; j++) { |
|
720 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
721 |
} |
|
722 |
double[] elevations = new double[pts.length]; |
|
723 |
for (int j = 0; j < pts.length; j++) { |
|
724 |
elevations[j] = pts[j].getZ(); |
|
725 |
} |
|
489 | 726 |
feature.set(ID_FIELD_ID,i); |
490 | 727 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
491 |
// feature.set(ID_FIELD_FSHAPE,"Point2D");
|
|
492 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
493 |
// .createValue(new String("FPoint2D"));
|
|
728 |
feature.set(ID_FIELD_FSHAPE,"Polyline3D");
|
|
729 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String(
|
|
730 |
// "FPolyline3D"));
|
|
494 | 731 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
495 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
496 |
// .createValue(new String(fea.getProp("dxfEntity")));
|
|
732 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(
|
|
733 |
// fea.getProp("dxfEntity"))); |
|
497 | 734 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
498 |
// auxRow[ID_FIELD_LAYER] = ValueFactory |
|
499 |
// .createValue(new String(fea.getProp("layer")));
|
|
735 |
// auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(
|
|
736 |
// fea.getProp("layer"))); |
|
500 | 737 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
501 | 738 |
feature.set(ID_FIELD_COLOR,auxInt); |
502 | 739 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
503 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
504 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
505 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
740 |
if (fea.getProp("elevation") != null) { |
|
741 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
742 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
743 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
744 |
} |
|
506 | 745 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
507 | 746 |
feature.set(ID_FIELD_THICKNESS,auxT); |
508 | 747 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
509 | 748 |
// Attributes |
510 | 749 |
for (int j = 0; j < nAtt; j++) { |
511 | 750 |
String[] attributes = new String[2]; |
512 |
attributes = (String[]) featureMaker.getAttributes() |
|
513 |
.get(j); |
|
751 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
514 | 752 |
feature.set(10+j,attributes[1]); |
515 | 753 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
516 |
// attributes[1]));
|
|
754 |
// attributes[1])); |
|
517 | 755 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
518 | 756 |
feature.set(10+j,fea.getProp(attributes[0])); |
519 |
// auxRow[10 + j] = ValueFactory |
|
520 |
// .createValue(new String(fea |
|
521 |
// .getProp(attributes[0]))); |
|
757 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
758 |
// fea.getProp(attributes[0]))); |
|
522 | 759 |
} |
523 | 760 |
} |
524 |
IGeometry geom=ShapeFactory.createPoint2D(new FPoint2D(pto.getX(), pto.getY()));
|
|
761 |
IGeometry geom=ShapeFactory.createPolyline3D(genPathX,elevations);
|
|
525 | 762 |
feature.set(ID_FIELD_FSHAPE,geom); |
526 | 763 |
// feature.setDefaultGeometry(geom); |
527 | 764 |
addFeature(feature); |
528 | 765 |
// addShape(nuevoShp, auxRow); |
529 |
} |
|
530 |
} else if (fea.getGeometry() instanceof org.cresques.px.gml.Point3D) { |
|
531 |
org.cresques.px.gml.Point3D point = (org.cresques.px.gml.Point3D) fea |
|
532 |
.getGeometry(); |
|
533 |
Point3D pto = new Point3D(); |
|
534 |
pto = point.getPoint3D(0); |
|
535 |
FShape nuevoShp; |
|
536 |
if (point.isTextPoint()) { |
|
766 |
} else if (fea.getGeometry() instanceof Polygon |
|
767 |
&& !(fea.getGeometry() instanceof Polygon3D)) { |
|
768 |
GeneralPathX genPathX = new GeneralPathX(); |
|
769 |
// 050112: A?ado una posici?n m?s para el punto que cierra y |
|
770 |
// creo el objeto firstPt. |
|
771 |
Point2D firstPt = new Point2D.Double(); |
|
772 |
firstPt = fea.getGeometry().get(0); |
|
773 |
Point2D[] pts = new Point2D[fea.getGeometry().pointNr() + 1]; |
|
774 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
775 |
pts[j] = fea.getGeometry().get(j); |
|
776 |
} |
|
777 |
// 050112: A?ado el primer punto al final para cerrar los |
|
778 |
// pol?gonos. |
|
779 |
pts[fea.getGeometry().pointNr()] = firstPt; |
|
780 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
781 |
for (int j = 1; j < pts.length; j++) { |
|
782 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
783 |
} |
|
537 | 784 |
feature.set(ID_FIELD_ID,i); |
538 | 785 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
539 |
feature.set(ID_FIELD_FSHAPE,"Point3D");
|
|
540 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
541 |
// .createValue(new String("FPoint3D"));
|
|
786 |
feature.set(ID_FIELD_FSHAPE,"Polygon2D");
|
|
787 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String(
|
|
788 |
// "FPolygon2D"));
|
|
542 | 789 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
543 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
544 |
// .createValue(new String(fea.getProp("dxfEntity")));
|
|
790 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(
|
|
791 |
// fea.getProp("dxfEntity"))); |
|
545 | 792 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
546 |
// auxRow[ID_FIELD_LAYER] = ValueFactory |
|
547 |
// .createValue(new String(fea.getProp("layer")));
|
|
793 |
// auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(
|
|
794 |
// fea.getProp("layer"))); |
|
548 | 795 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
549 | 796 |
feature.set(ID_FIELD_COLOR,auxInt); |
550 | 797 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
551 |
feature.set(ID_FIELD_TEXT,fea.getProp("text")); |
|
552 |
// auxRow[ID_FIELD_TEXT] = ValueFactory |
|
553 |
// .createValue(new String(fea.getProp("text"))); |
|
554 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
555 |
feature.set(ID_FIELD_HEIGHTTEXT,heightText); |
|
556 |
// auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory |
|
557 |
// .createValue(heightText); |
|
558 |
double auxR = Double.parseDouble(fea |
|
559 |
.getProp("textRotation")); |
|
560 |
feature.set(ID_FIELD_ROTATIONTEXT,auxR); |
|
561 |
// auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory |
|
562 |
// .createValue(auxR); |
|
563 | 798 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
564 | 799 |
feature.set(ID_FIELD_ELEVATION,auxE); |
565 | 800 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
... | ... | |
569 | 804 |
// Attributes |
570 | 805 |
for (int j = 0; j < nAtt; j++) { |
571 | 806 |
String[] attributes = new String[2]; |
572 |
attributes = (String[]) featureMaker.getAttributes() |
|
573 |
.get(j); |
|
807 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
574 | 808 |
feature.set(10+j,attributes[1]); |
575 | 809 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
576 |
// attributes[1]));
|
|
810 |
// attributes[1])); |
|
577 | 811 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
578 | 812 |
feature.set(10+j,fea.getProp(attributes[0])); |
579 |
// auxRow[10 + j] = ValueFactory |
|
580 |
// .createValue(new String(fea |
|
581 |
// .getProp(attributes[0]))); |
|
813 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
814 |
// fea.getProp(attributes[0]))); |
|
582 | 815 |
} |
583 | 816 |
} |
584 |
IGeometry geom=ShapeFactory.createPoint3D(pto.getX(), pto.getY(), pto.getZ());
|
|
817 |
IGeometry geom=ShapeFactory.createPolygon2D(genPathX);
|
|
585 | 818 |
feature.set(ID_FIELD_FSHAPE,geom); |
586 | 819 |
// feature.setDefaultGeometry(geom); |
587 | 820 |
addFeature(feature); |
588 | 821 |
// addShape(nuevoShp, auxRow); |
589 |
} else { |
|
822 |
} else if (fea.getGeometry() instanceof Polygon3D) { |
|
823 |
GeneralPathX genPathX = new GeneralPathX(); |
|
824 |
// 050112: A?ado una posici?n m?s para el punto que cierra y |
|
825 |
// creo el objeto firstPt. |
|
826 |
Point3D firstPt = new Point3D(); |
|
827 |
firstPt = ((Polygon3D) fea.getGeometry()) |
|
828 |
.getPoint3D(0); |
|
829 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr() + 1]; |
|
830 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
831 |
pts[j] = ((Polygon3D) fea.getGeometry()) |
|
832 |
.getPoint3D(j); |
|
833 |
} |
|
834 |
// 050112: A?ado el primer punto al final para cerrar los |
|
835 |
// pol?gonos. |
|
836 |
pts[fea.getGeometry().pointNr()] = firstPt; |
|
837 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
838 |
for (int j = 1; j < pts.length; j++) { |
|
839 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
840 |
} |
|
841 |
double[] elevations = new double[pts.length]; |
|
842 |
for (int j = 0; j < pts.length; j++) { |
|
843 |
elevations[j] = pts[j].getZ(); |
|
844 |
} |
|
590 | 845 |
feature.set(ID_FIELD_ID,i); |
591 | 846 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
592 |
feature.set(ID_FIELD_FSHAPE,"Point3D");
|
|
593 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
594 |
// .createValue(new String("FPoint3D"));
|
|
847 |
feature.set(ID_FIELD_FSHAPE,"Polygon3D");
|
|
848 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String(
|
|
849 |
// "FPolygon3D"));
|
|
595 | 850 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
596 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
597 |
// .createValue(new String(fea.getProp("dxfEntity")));
|
|
851 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(
|
|
852 |
// fea.getProp("dxfEntity"))); |
|
598 | 853 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
599 |
// auxRow[ID_FIELD_LAYER] = ValueFactory |
|
600 |
// .createValue(new String(fea.getProp("layer")));
|
|
854 |
// auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(
|
|
855 |
// fea.getProp("layer"))); |
|
601 | 856 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
602 | 857 |
feature.set(ID_FIELD_COLOR,auxInt); |
603 | 858 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
604 |
|
|
605 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
606 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
607 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
859 |
if (fea.getProp("elevation") != null) { |
|
860 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
861 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
862 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
863 |
} |
|
608 | 864 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
609 | 865 |
feature.set(ID_FIELD_THICKNESS,auxT); |
610 | 866 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
611 | 867 |
// Attributes |
612 | 868 |
for (int j = 0; j < nAtt; j++) { |
613 | 869 |
String[] attributes = new String[2]; |
614 |
attributes = (String[]) featureMaker.getAttributes() |
|
615 |
.get(j); |
|
870 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
616 | 871 |
feature.set(10+j,attributes[1]); |
617 | 872 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
618 |
// attributes[1]));
|
|
873 |
// attributes[1])); |
|
619 | 874 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
620 | 875 |
feature.set(10+j,fea.getProp(attributes[0])); |
621 |
// auxRow[10 + j] = ValueFactory |
|
622 |
// .createValue(new String(fea |
|
623 |
// .getProp(attributes[0]))); |
|
876 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
877 |
// fea.getProp(attributes[0]))); |
|
624 | 878 |
} |
625 | 879 |
} |
626 |
IGeometry geom=ShapeFactory.createPoint3D(pto.getX(), pto.getY(), pto.getZ());
|
|
880 |
IGeometry geom=ShapeFactory.createPolygon3D(genPathX,elevations);
|
|
627 | 881 |
feature.set(ID_FIELD_FSHAPE,geom); |
628 | 882 |
// feature.setDefaultGeometry(geom); |
629 | 883 |
addFeature(feature); |
630 | 884 |
// addShape(nuevoShp, auxRow); |
885 |
} else { |
|
886 |
// System.out.println("Detectado feature desconocido"); |
|
631 | 887 |
} |
632 |
} else if (fea.getGeometry() instanceof LineString |
|
633 |
&& !(fea.getGeometry() instanceof LineString3D)) { |
|
634 |
GeneralPathX genPathX = new GeneralPathX(); |
|
635 |
Point2D[] pts = new Point2D[fea.getGeometry().pointNr()]; |
|
636 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
637 |
pts[j] = fea.getGeometry().get(j); |
|
638 |
} |
|
639 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
640 |
for (int j = 1; j < pts.length; j++) { |
|
641 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
642 |
} |
|
643 |
feature.set(ID_FIELD_ID,i); |
|
644 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
645 |
feature.set(ID_FIELD_FSHAPE,"Polyline2D"); |
|
646 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
647 |
// "FPolyline2D")); |
|
648 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
|
649 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
650 |
// fea.getProp("dxfEntity"))); |
|
651 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
|
652 |
// auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
653 |
// fea.getProp("layer"))); |
|
654 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
655 |
feature.set(ID_FIELD_COLOR,auxInt); |
|
656 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
657 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
658 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
659 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
660 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
661 |
feature.set(ID_FIELD_THICKNESS,auxT); |
|
662 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
663 |
// Attributes |
|
664 |
for (int j = 0; j < nAtt; j++) { |
|
665 |
String[] attributes = new String[2]; |
|
666 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
667 |
feature.set(10+j,attributes[1]); |
|
668 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
669 |
// attributes[1])); |
|
670 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
671 |
feature.set(10+j,fea.getProp(attributes[0])); |
|
672 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
673 |
// fea.getProp(attributes[0]))); |
|
674 |
} |
|
675 |
} |
|
676 |
IGeometry geom=ShapeFactory.createPolyline2D(genPathX); |
|
677 |
feature.set(ID_FIELD_FSHAPE,geom); |
|
678 |
// feature.setDefaultGeometry(geom); |
|
679 |
addFeature(feature); |
|
680 |
// addShape(nuevoShp, auxRow); |
|
681 |
} else if (fea.getGeometry() instanceof LineString3D) { |
|
682 |
GeneralPathX genPathX = new GeneralPathX(); |
|
683 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr()]; |
|
684 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
685 |
pts[j] = ((LineString3D) fea.getGeometry()).getPoint3D(j); |
|
686 |
} |
|
687 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
688 |
for (int j = 1; j < pts.length; j++) { |
|
689 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
690 |
} |
|
691 |
double[] elevations = new double[pts.length]; |
|
692 |
for (int j = 0; j < pts.length; j++) { |
|
693 |
elevations[j] = pts[j].getZ(); |
|
694 |
} |
|
695 |
feature.set(ID_FIELD_ID,i); |
|
696 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
697 |
feature.set(ID_FIELD_FSHAPE,"Polyline3D"); |
|
698 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
699 |
// "FPolyline3D")); |
|
700 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
|
701 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
702 |
// fea.getProp("dxfEntity"))); |
|
703 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
|
704 |
// auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
705 |
// fea.getProp("layer"))); |
|
706 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
707 |
feature.set(ID_FIELD_COLOR,auxInt); |
|
708 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
709 |
if (fea.getProp("elevation") != null) { |
|
710 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
711 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
712 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
713 |
} |
|
714 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
715 |
feature.set(ID_FIELD_THICKNESS,auxT); |
|
716 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
717 |
// Attributes |
|
718 |
for (int j = 0; j < nAtt; j++) { |
|
719 |
String[] attributes = new String[2]; |
|
720 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
721 |
feature.set(10+j,attributes[1]); |
|
722 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
723 |
// attributes[1])); |
|
724 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
725 |
feature.set(10+j,fea.getProp(attributes[0])); |
|
726 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
727 |
// fea.getProp(attributes[0]))); |
|
728 |
} |
|
729 |
} |
|
730 |
IGeometry geom=ShapeFactory.createPolyline3D(genPathX,elevations); |
|
731 |
feature.set(ID_FIELD_FSHAPE,geom); |
|
732 |
// feature.setDefaultGeometry(geom); |
|
733 |
addFeature(feature); |
|
734 |
// addShape(nuevoShp, auxRow); |
|
735 |
} else if (fea.getGeometry() instanceof Polygon |
|
736 |
&& !(fea.getGeometry() instanceof Polygon3D)) { |
|
737 |
GeneralPathX genPathX = new GeneralPathX(); |
|
738 |
// 050112: A?ado una posici?n m?s para el punto que cierra y |
|
739 |
// creo el objeto firstPt. |
|
740 |
Point2D firstPt = new Point2D.Double(); |
|
741 |
firstPt = fea.getGeometry().get(0); |
|
742 |
Point2D[] pts = new Point2D[fea.getGeometry().pointNr() + 1]; |
|
743 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
744 |
pts[j] = fea.getGeometry().get(j); |
|
745 |
} |
|
746 |
// 050112: A?ado el primer punto al final para cerrar los |
|
747 |
// pol?gonos. |
|
748 |
pts[fea.getGeometry().pointNr()] = firstPt; |
|
749 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
750 |
for (int j = 1; j < pts.length; j++) { |
|
751 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
752 |
} |
|
753 |
feature.set(ID_FIELD_ID,i); |
|
754 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
755 |
feature.set(ID_FIELD_FSHAPE,"Polygon2D"); |
|
756 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
757 |
// "FPolygon2D")); |
|
758 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
|
759 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
760 |
// fea.getProp("dxfEntity"))); |
|
761 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
|
762 |
// auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
763 |
// fea.getProp("layer"))); |
|
764 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
765 |
feature.set(ID_FIELD_COLOR,auxInt); |
|
766 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
767 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
768 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
769 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
770 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
771 |
feature.set(ID_FIELD_THICKNESS,auxT); |
|
772 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
773 |
// Attributes |
|
774 |
for (int j = 0; j < nAtt; j++) { |
|
775 |
String[] attributes = new String[2]; |
|
776 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
777 |
feature.set(10+j,attributes[1]); |
|
778 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
779 |
// attributes[1])); |
|
780 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
781 |
feature.set(10+j,fea.getProp(attributes[0])); |
|
782 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
783 |
// fea.getProp(attributes[0]))); |
|
784 |
} |
|
785 |
} |
|
786 |
IGeometry geom=ShapeFactory.createPolygon2D(genPathX); |
|
787 |
feature.set(ID_FIELD_FSHAPE,geom); |
|
788 |
// feature.setDefaultGeometry(geom); |
|
789 |
addFeature(feature); |
|
790 |
// addShape(nuevoShp, auxRow); |
|
791 |
} else if (fea.getGeometry() instanceof Polygon3D) { |
|
792 |
GeneralPathX genPathX = new GeneralPathX(); |
|
793 |
// 050112: A?ado una posici?n m?s para el punto que cierra y |
|
794 |
// creo el objeto firstPt. |
|
795 |
Point3D firstPt = new Point3D(); |
|
796 |
firstPt = ((Polygon3D) fea.getGeometry()) |
|
797 |
.getPoint3D(0); |
|
798 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr() + 1]; |
|
799 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
800 |
pts[j] = ((Polygon3D) fea.getGeometry()) |
|
801 |
.getPoint3D(j); |
|
802 |
} |
|
803 |
// 050112: A?ado el primer punto al final para cerrar los |
|
804 |
// pol?gonos. |
|
805 |
pts[fea.getGeometry().pointNr()] = firstPt; |
|
806 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
807 |
for (int j = 1; j < pts.length; j++) { |
|
808 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
809 |
} |
|
810 |
double[] elevations = new double[pts.length]; |
|
811 |
for (int j = 0; j < pts.length; j++) { |
|
812 |
elevations[j] = pts[j].getZ(); |
|
813 |
} |
|
814 |
feature.set(ID_FIELD_ID,i); |
|
815 |
// auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
816 |
feature.set(ID_FIELD_FSHAPE,"Polygon3D"); |
|
817 |
// auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
818 |
// "FPolygon3D")); |
|
819 |
feature.set(ID_FIELD_ENTITY,fea.getProp("dxfEntity")); |
|
820 |
// auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
821 |
// fea.getProp("dxfEntity"))); |
|
822 |
feature.set(ID_FIELD_LAYER,fea.getProp("layer")); |
|
823 |
// auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
824 |
// fea.getProp("layer"))); |
|
825 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
826 |
feature.set(ID_FIELD_COLOR,auxInt); |
|
827 |
// auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
828 |
if (fea.getProp("elevation") != null) { |
|
829 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
830 |
feature.set(ID_FIELD_ELEVATION,auxE); |
|
831 |
// auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
832 |
} |
|
833 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
834 |
feature.set(ID_FIELD_THICKNESS,auxT); |
|
835 |
// auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
836 |
// Attributes |
|
837 |
for (int j = 0; j < nAtt; j++) { |
|
838 |
String[] attributes = new String[2]; |
|
839 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
840 |
feature.set(10+j,attributes[1]); |
|
841 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
842 |
// attributes[1])); |
|
843 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
844 |
feature.set(10+j,fea.getProp(attributes[0])); |
|
845 |
// auxRow[10 + j] = ValueFactory.createValue(new String( |
|
846 |
// fea.getProp(attributes[0]))); |
|
847 |
} |
|
848 |
} |
|
849 |
IGeometry geom=ShapeFactory.createPolygon3D(genPathX,elevations); |
|
850 |
feature.set(ID_FIELD_FSHAPE,geom); |
|
851 |
// feature.setDefaultGeometry(geom); |
|
852 |
addFeature(feature); |
|
853 |
// addShape(nuevoShp, auxRow); |
|
854 |
} else { |
|
855 |
// System.out.println("Detectado feature desconocido"); |
|
888 |
feature.stopLoading(); |
|
889 |
}catch (IsNotFeatureSettingException e) { |
|
890 |
e.printStackTrace(); |
|
856 | 891 |
} |
857 |
feature.stopLoading(); |
|
858 | 892 |
} |
859 | 893 |
|
860 | 894 |
defaultLegend = LegendFactory |
Also available in: Unified diff