Package ch.interlis.iom

Examples of ch.interlis.iom.IomObject


                .getattrvaluecount("sequence"); sequencei++) {
            if (!clipped && sequencei > 0) {
                throw new IllegalArgumentException();
            }

            IomObject sequence = polylineObj.getattrobj("sequence", sequencei);
            for (int segmenti = 0; segmenti < sequence
                    .getattrvaluecount("segment"); segmenti++) {
                IomObject segment = sequence.getattrobj("segment", segmenti);
                if (segment.getobjecttag().equals("COORD")) {

                    String c1 = segment.getattrvalue("C1");
                    String c2 = segment.getattrvalue("C2");
                    // String c3=segment.getattrvalue("C3");

                    Coordinate coord = new Coordinate(Double.valueOf(c1),
                            Double.valueOf(c2));
                    coords.add(coord, false);

                } else if (segment.getobjecttag().equals("ARC")) {
                    String a1 = segment.getattrvalue("A1");
                    String a2 = segment.getattrvalue("A2");
                    String c1 = segment.getattrvalue("C1");
                    String c2 = segment.getattrvalue("C2");
                    // String c3=segment.getattrvalue("C3");

                    Coordinate ptStart = coords
                            .getCoordinate(coords.size() - 1);
                    Coordinate ptArc = new Coordinate(Double.valueOf(a1),
View Full Code Here


            Boolean curves = false;
            StringBuffer line = new StringBuffer("(");
            String c1_tmp = null;
            String c2_tmp = null;

            IomObject sequence = polylineObj.getattrobj("sequence", sequencei);
            for (int segmenti = 0; segmenti < sequence
                    .getattrvaluecount("segment"); segmenti++) {
                IomObject segment = sequence.getattrobj("segment", segmenti);
                if (segment.getobjecttag().equals("COORD")) {

                    if (curved) {
                        line.append(",(");
                        line.append(c1_tmp + " " + c2_tmp);
                        line.append(",");
                        curved = false;
                    }

                    String c1 = segment.getattrvalue("C1");
                    String c2 = segment.getattrvalue("C2");
                    String c3 = segment.getattrvalue("C3");

                    line.append(c1 + " " + c2);
                    line.append(",");

                    c1_tmp = c1;
                    c2_tmp = c2;

                } else if (segment.getobjecttag().equals("ARC")) {

                    // Falls ein Circuarstring vorangegangen ist,
                    // muss noch ein Komma gesetzt werden.
                    if (curved) {
                        line.append(",");
                    }

                    // Liniensegment abschliessen, aber nur
                    // falls kein Circularstring vorangegangen
                    // ist.
                    if (segmenti != 0 && curved == false) {
                        line.deleteCharAt(line.length() - 1);
                        line.append("),");
                    }

                    // Flags für Kreisbogen setzen
                    curved = true;
                    curves = true;

                    String c1 = segment.getattrvalue("C1");
                    String c2 = segment.getattrvalue("C2");
                    String c3 = segment.getattrvalue("C3");
                    String a1 = segment.getattrvalue("A1");
                    String a2 = segment.getattrvalue("A2");

                    String curve = "CIRCULARSTRING(" + c1_tmp + " " + c2_tmp
                            + "," + a1 + " " + a2 + "," + c1 + " " + c2 + ")";

                    line.append(curve);
View Full Code Here

                StartBasketEvent basket = (StartBasketEvent) event;
                logger.debug(basket.getType() + "(oid " + basket.getBid()
                        + ")...");

            } else if (event instanceof ObjectEvent) {
                IomObject iomObj = ((ObjectEvent) event).getIomObject();
                String tag = iomObj.getobjecttag();
                readObject(iomObj, tag);
                featureName = tag;
            } else if (event instanceof EndBasketEvent) {
                // do nothing
            } else if (event instanceof EndTransferEvent) {
View Full Code Here

                        // what is this good for?
                        if (type instanceof CompositionType) {
                            logger.debug("CompositionType");
                            int valuec = iomObj.getattrvaluecount(attrName);
                            for (int valuei = 0; valuei < valuec; valuei++) {
                                IomObject value = iomObj.getattrobj(attrName,
                                        valuei);
                                if (value != null) {
                                    // do nothing...
                                }
                            }
                        } else if (type instanceof PolylineType) {
                            IomObject value = iomObj.getattrobj(attrName, 0);
                            if (value != null) {
                                featBuilder.set(attrName.toLowerCase(),
                                        Iox2wkt.polyline2jts(value, 0));
                            } else {
                                featBuilder.set(attrName.toLowerCase(), null);
                            }
                        } else if (type instanceof SurfaceType) {
                            isSurfaceMain = true;
                            geomName = attrName.toLowerCase();
                        } else if (type instanceof AreaType) {
                            isAreaMain = true;
                            IomObject value = iomObj.getattrobj(attrName, 0);
                            try {
                                Point point = new GeometryFactory()
                                        .createPoint(Iox2jts.coord2JTS(value));
                                // point.setSRID( Integer.parseInt(this.epsg) );
                                featBuilder.set(attrName.toLowerCase()
                                        + "_point", point);
                                geomName = attrName.toLowerCase();
                            } catch (Iox2jtsException e) {
                                e.printStackTrace();
                                logger.warn(e.getMessage());
                            }
                        } else if (type instanceof CoordType) {
                            IomObject value = iomObj.getattrobj(attrName, 0);
                            if (value != null) {
                                if (!value.getobjecttag().equals("COORD")) {
                                    logger.warn("object tag <> COORD");
                                } else {
                                    try {
                                        Point point = new GeometryFactory()
                                                .createPoint(Iox2jts
                                                        .coord2JTS(value));
                                        featBuilder.set(attrName.toLowerCase(),
                                                point);
                                    } catch (Iox2jtsException e) {
                                        e.printStackTrace();
                                        logger.warn(e.getMessage());
                                    }
                                }
                            }
                        } else if (type instanceof NumericType) {
                            String value = iomObj.getattrvalue(attrName);
                            if (value != null) {
                                featBuilder.set(attrName.toLowerCase(),
                                        Double.valueOf(value));
                            } else {
                                featBuilder.set(attrName.toLowerCase(), null);
                            }
                        } else if (type instanceof EnumerationType) {
                            String value = iomObj.getattrvalue(attrName);
                            if (value != null) {
                                featBuilder.set(attrName.toLowerCase(),
                                        Integer.valueOf(value));
                                if (true == true) {
                                    featBuilder.set(attrName.toLowerCase()
                                            + "_txt", enumCodeMapper
                                            .mapItfCode2XtfCode(
                                                    (EnumerationType) type,
                                                    value));
                                }
                            } else {
                                featBuilder.set(attrName.toLowerCase(), null);
                                if (true) {
                                    featBuilder.set(attrName.toLowerCase()
                                            + "_txt", null);
                                }
                            }
                        } else {
                            String value = iomObj.getattrvalue(attrName);
                            if (value != null) {
                                featBuilder.set(attrName.toLowerCase(), value);
                            } else {
                                featBuilder.set(attrName.toLowerCase(), null);
                            }
                        }
                    }
                    if (obj.obj instanceof RoleDef) {
                        RoleDef role = (RoleDef) obj.obj;
                        String roleName = role.getName();

                        IomObject structvalue = iomObj.getattrobj(roleName, 0);
                        String refoid = "";
                        if (structvalue != null) {
                            if (((ItfReader) ioxReader).isRenumberTids()) {
                                refoid = getTidOrRef(structvalue
                                        .getobjectrefoid());
                            } else {
                                refoid = structvalue.getobjectrefoid();
                            }
                        }
                        featBuilder.set(roleName.toLowerCase(),
                                refoid.toString());
                    }
                }
            } else if (tableObj instanceof LocalAttribute) {
                LocalAttribute localAttr = (LocalAttribute) tag2class
                        .get(iomObj.getobjecttag());
                Type type = localAttr.getDomainResolvingAliases();

                if (type instanceof SurfaceType) {
                    isSurfaceHelper = true;
                    geomName = localAttr.getName().toLowerCase();

                    String fkName = ch.interlis.iom_j.itf.ModelUtilities
                            .getHelperTableMainTableRef(localAttr);
                    IomObject structvalue = iomObj.getattrobj(fkName, 0);
                    String refoid = null;
                    if (((ItfReader) ioxReader).isRenumberTids()) {
                        refoid = getTidOrRef(structvalue.getobjectrefoid());
                    } else {
                        refoid = structvalue.getobjectrefoid();
                    }
                    featBuilder.set("_itf_ref", refoid);

                    IomObject value = iomObj.getattrobj(
                            ch.interlis.iom_j.itf.ModelUtilities
                                    .getHelperTableGeomAttrName(localAttr), 0);
                    if (value != null) {
                        PrecisionDecimal maxOverlaps = ((SurfaceType) type)
                                .getMaxOverlap();
                        if (maxOverlaps == null) {
                            featBuilder.set(localAttr.getName().toLowerCase(),
                                    Iox2wkt.polyline2jts(value, 0.02));
                        } else {
                            // featBuilder.set(localAttr.getName().toLowerCase(),
                            // Iox2wkt.polyline2jts( value,
                            // maxOverlaps.doubleValue() ) );
                            featBuilder.set(localAttr.getName().toLowerCase(),
                                    Iox2wkt.polyline2jts(value, 0.001));
                        }
                    }
                } else if (type instanceof AreaType) {
                    isAreaHelper = true;
                    geomName = localAttr.getName().toLowerCase();

                    String fkName = ch.interlis.iom_j.itf.ModelUtilities
                            .getHelperTableMainTableRef(localAttr);
                    IomObject structvalue = iomObj.getattrobj(fkName, 0);

                    featBuilder.set("_itf_ref", null);

                    IomObject value = iomObj.getattrobj(
                            ch.interlis.iom_j.itf.ModelUtilities
                                    .getHelperTableGeomAttrName(localAttr), 0);
                    if (value != null) {
                        PrecisionDecimal maxOverlaps = ((AreaType) type)
                                .getMaxOverlap();
View Full Code Here

TOP

Related Classes of ch.interlis.iom.IomObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.