Package com.bbn.openmap.omGraphics

Examples of com.bbn.openmap.omGraphics.OMPoly


        double ltmin = lnmin;
        double ltmax = lnmax;
        double lt;
        double ln;
        for (int i = 0; i < n; i++) {
            OMPoly oj = (OMPoly) arcs.getOMGraphicAt(i);
            if (oj == null)
                continue;
            E00Data data = (E00Data) oj.getAppObject();
            if (data == null)
                continue;
            ll = oj.getLatLonArray();
            llsize = ll.length;
            if ((ll[0] != ll[llsize - 2]) || (ll[1] != ll[llsize - 1])) {
                // contour non clos;
                float[] coords = new float[] { ll[0], ll[1], ll[llsize - 2],
                        ll[llsize - 1] };
                ArcData dn = new ArcData(data);
                dn.coords = coords;
                oj.setAppObject(dn);
                V.add(dn);
            }
            int k = 0;
            while (k < llsize) {
                lt = ll[k++];
                ln = ll[k++];
                if (lt > ltmax)
                    ltmax = lt;
                else if (lt < ltmin)
                    ltmin = lt;
                if (ln > lnmax)
                    lnmax = ln;
                else if (ln < lnmin)
                    lnmin = ln;
            }
        }
        System.out.println("#minmax " + lnmin + " " + lnmax + " " + ltmin + " "
                + ltmax);
        int unClosedCount = V.size();
        ArcData[] unClosed = (ArcData[]) V.toArray(new ArcData[unClosedCount]);

        V.clear();
        V = null;
        //chercher les connections;
        ArcData d0;
        //chercher les connections;
        ArcData d1;
        //chercher les connections;
        ArcData d2;
        //chercher les connections;
        ArcData dx;
        float lt1;
        float lg1;
        float lt2;
        float lg2;
        for (int i = 0; i < unClosedCount; i++) {
            d0 = unClosed[i];
            d0.deja = 0;
            if (d0.type > 1)
                continue;
            lt1 = d0.coords[0];
            lg1 = d0.coords[1];
            lt2 = d0.coords[2];
            lg2 = d0.coords[3];
            for (int j = i + 1; j < unClosedCount; j++) {
                d1 = unClosed[j];
                if (d1.type > 1)
                    continue;
                if ((lt1 == d1.coords[0]) && (lg1 == d1.coords[1])) {
                    d1.setC(d0);
                    d0.setC(d1);
                } else if ((lt1 == d1.coords[2]) && (lg1 == d1.coords[3])) {
                    d1.setF(d0);
                    d0.setC(d1);
                }
                if ((lt2 == d1.coords[0]) && (lg2 == d1.coords[1])) {
                    d1.setC(d0);
                    d0.setF(d1);
                } else if ((lt2 == d1.coords[2]) && (lg2 == d1.coords[3])) {
                    d1.setF(d0);
                    d0.setF(d1);
                }
            }
        }
        for (int k = 0; k < unClosedCount; k++) {
            d0 = unClosed[k];
            if ((d0.type != 0) || (d0.deja != 0))
                continue;
            if ((d0.c0 == null) && (d0.f0 == null))
                continue;
            d1 = d0;
            d2 = (d1.c0 == null) ? d1.f0 : d1.c0;
            System.out.print("#contour ");
            System.out.print(d0.id);
            System.out.print(' ');
            int decount = unClosedCount * 3 / 2;
            do {
                System.out.print(d2.id);
                if (d2.deja != 0)
                    System.out.print('*');
                System.out.print(' ');
                dx = d2.visit(d1);
                d1 = d2;
                d2 = dx;
                if (decount-- < 0) {
                    System.out.print(" BOUCLE ");
                    break;
                }
            } while ((d2 != null) && (d2 != d0));
            if (d2 == null)
                System.out.print(" unclosed");
            System.out.println();
            System.out.println();
        }

        for (int i = 0; i < n; i++) {
            OMPoly oj = (OMPoly) arcs.getOMGraphicAt(i);
            if (oj == null)
                continue;
            E00Data data = (E00Data) oj.getAppObject();
            if (data == null)
                continue;
            ll = oj.getLatLonArray();
            llsize = ll.length;
            double z = data.valeur * 0.304;
//            double z2 = data.valeur2 * 0.304;
            boolean closed = true;
//            float[] coords = null;
View Full Code Here


            return;
        }

        n = arcs.size();
        for (int i = 0; i < n; i++) {
            OMPoly oj = (OMPoly) arcs.getOMGraphicAt(i);
            if (oj == null)
                continue;
            if (!oj.isSelected())
                continue;
            ll = oj.getLatLonArray();
            llsize = ll.length;
            out.println(oj.getLinePaint());
            if ((ll[0] != ll[llsize - 2]) || (ll[1] != ll[llsize - 1]))
                out.print("MetaPolyline: ");
            else {
                llsize -= 2;
                out.print("MetaPolyline: ");
            }
            out.print(llsize / 2);
            Object o = oj.getAppObject();
            if (o != null && o instanceof String)
                System.out.println(o);
            else
                out.println();
            int k = 0;
View Full Code Here

                OMGraphicList saveGraphics = new OMGraphicList();
                for (int i = 0; i < nGraphics; i++) {
                    OMGraphic omg = graphics.getOMGraphicAt(i);
                    if ((omg instanceof OMPoly)
                            && (omg.getRenderType() == OMGraphic.RENDERTYPE_LATLON)) {
                        OMPoly poly = (OMPoly) omg;

                        if (maybeThrowAwayPoly(poly)) {
                            continue;
                        }
View Full Code Here

        }

        // iterate through the polylines and join lines with common
        // endpoints
        size = plineGraphics.size();
        OMPoly poly1, poly2;
        float[] rads1, rads2, radians;
        System.out.println("maybe joining " + size + " polylines...");
        // nasty!: > O(n^2)
        for (int i = 0; i < size; i++) {
            if (i % 500 == 0) {
                System.out.println("checking pline i=" + i);
            }
            for (int j = 0; j < size; j++) {
                if (i == j) {
                    continue;
                }
                obj = plineGraphics.getOMGraphicAt(i);
                if (obj instanceof SinkGraphic) {
                    continue;
                }
                poly1 = (OMPoly) obj;
                rads1 = poly1.getLatLonArray();
                len1 = rads1.length;
                lat1 = ProjMath.radToDeg(rads1[len1 - 2]);
                lon1 = ProjMath.radToDeg(rads1[len1 - 1]);

                obj = plineGraphics.getOMGraphicAt(j);
                if (obj instanceof SinkGraphic) {
                    continue;
                }
                poly2 = (OMPoly) obj;
                rads2 = poly2.getLatLonArray();
                len2 = rads2.length;
                lat2 = ProjMath.radToDeg(rads2[0]);
                lon2 = ProjMath.radToDeg(rads2[1]);

                if (MoreMath.approximately_equal(lat1, lat2, zero_eps)
                        && MoreMath.approximately_equal(lon1, lon2, zero_eps)) {
                    // System.out.println("joining...");
                    radians = new float[len1 + len2 - 2];
                    System.arraycopy(rads1, 0, radians, 0, len1);
                    System.arraycopy(rads2, 0, radians, len1 - 2, len2);
                    poly1.setLocation(radians, OMGraphic.RADIANS);
                    plineGraphics.setOMGraphicAt(SinkGraphic.getSharedInstance(),
                            j);
                    j = -1;// redo search
                }
            }
View Full Code Here

        }
        if (totalSize == 0) {
            return;
        }

        OMPoly py = createAreaOMPoly(ipts,
                totalSize,
                ll1,
                ll2,
                dpplat,
                dpplon,
                covtable.doAntarcticaWorkaround);

        //        getAttributesForFeature(featureType).setTo(py);
        int id = ((Integer) facevec.get(0)).intValue();
        setAttributesForFeature(py, covtable, featureType, id);
        // HACK to get tile boundaries to not show up for areas.
        //         py.setLinePaint(py.getFillPaint());
        //         py.setSelectPaint(py.getFillPaint());
        py.setLinePaint(OMColor.clear);
        py.setSelectPaint(OMColor.clear);

        addArea(py);
    }
View Full Code Here

                           float dpplon, CoordFloatString coords,
                           String featureType) {

        int id = ((Integer) edgevec.get(0)).intValue();

        OMPoly py = createEdgeOMPoly(coords, ll1, ll2, dpplat, dpplon);
        setAttributesForFeature(py, c, featureType, id);
        py.setFillPaint(OMColor.clear);
        py.setIsPolygon(false);
        addEdge(py);
    }
View Full Code Here

     *
     * @param myLine - Database object which will be rendered
     */
    protected OMGraphic createLine(MysqlLine myLine) {

        OMPoly ompoly = new OMPoly(DoubleToFloat(myLine.getCoordinateArray()), OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_STRAIGHT);

        drawingAttributes.setTo(ompoly);
        return ompoly;
    }
View Full Code Here

    protected OMGraphic createPolygon(MysqlPolygon myPoly) {
        Vector v = myPoly.getRings();
        int size = v.size();

        OMGraphic ret = null;
        OMPoly ompoly = null;
        OMGraphicList subList = null;

        if (size > 1) {
            subList = new OMGraphicList();
            ret = subList;
        }

        for (int i = 0; i < size; i++) {
            ompoly = new OMPoly(DoubleToFloat((double[]) v.elementAt(i)), OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_STRAIGHT);

            drawingAttributes.setTo(ompoly);

            if (subList != null) {
                subList.add(ompoly);
View Full Code Here

                llpoints[k++] = coords[3];
                llpoints[k++] = coords[2];
            }
            //System.out.print("f ");
            //System.out.println(" # "+narc++ +" nb:"+npoint);
            OMPoly P = new OMPoly(llpoints, OMGraphic.DECIMAL_DEGREES, OMGraphic.LINETYPE_STRAIGHT);
            P.setLinePaint(getArcPaint(0));
            if (SelectArcColor != null)
                P.setSelectPaint(SelectArcColor);

            arcs.add(P);
            P.setAppObject(new E00Data(narc++));
        }
    }
View Full Code Here

                if (typeMatches(eg)) {
                    graphics.add(eg);
                    addExtents(eg.getExtents());
                }
            } else if (shape instanceof OMLine) {
                OMPoly omp = EsriPolylineList.convert((OMLine) shape);
                if (omp != null) {
                    EsriPolyline eg = convert(omp);
                    if (typeMatches(eg)) {
                        graphics.add(eg);
                        addExtents(eg.getExtents());
View Full Code Here

TOP

Related Classes of com.bbn.openmap.omGraphics.OMPoly

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.