Package com.bbn.openmap.proj

Examples of com.bbn.openmap.proj.Projection


                InputStream inputStream = url.openStream();

                props = new Properties();
                props.load(inputStream);

                Projection proj = null;

                String finalOutputPath = ImageServer.createImageFile(null,
                        props,
                        proj,
                        imagefile);
View Full Code Here


        if (spatialIndexes == null || spatialIndexes.size() == 0) {
            Debug.message("shape", "MultiShapeLayer: spatialIndexes is empty!");
            return new OMGraphicList();
        }

        Projection projection = getProjection();

        if (projection == null) {
            // This can happen if the layer is part of a
            // ScaleFilterLayer, and the redraw button for this layer
            // is pressed before the ScaleFilterLayer gives it a
            // projection (which only happens if the layer is the
            // active one).
            Debug.message("basic", "MultiShapeLayer|" + getName()
                    + ": prepare called with null projection");
            return new OMGraphicList();
        }

        LatLonPoint ul = projection.getUpperLeft();
        LatLonPoint lr = projection.getLowerRight();
        float ulLat = ul.getLatitude();
        float ulLon = ul.getLongitude();
        float lrLat = lr.getLatitude();
        float lrLon = lr.getLongitude();

        OMGraphicList masterList = new OMGraphicList();
        OMGraphicList list = null;
        SpatialIndexHandler sih;
        Iterator sii;

        // check for dateline anomaly on the screen. we check for
        // ulLon >= lrLon, but we need to be careful of the check for
        // equality because of floating point arguments...
        if (ProjMath.isCrossingDateline(ulLon, lrLon, projection.getScale())) {
            if (Debug.debugging("shape")) {
                Debug.output("MultiShapeLayer.computeGraphics(): Dateline is on screen");
            }

            double ymin = (double) Math.min(ulLat, lrLat);
View Full Code Here

        return layer;
    }

    public void projectionChanged(ProjectionEvent pe) {
        if (layer != null) {
            Projection proj = layer.setProjection(pe);
            // proj will be null if the projection hasn't changed, a
            // signal that work does not need to be done.
            if (proj != null) {
                if (Debug.debugging("layer")) {
                    Debug.output(getLayer().getName()
View Full Code Here

     * generating things we won't see, and let the RenderPolicy check
     * to see if the list should be painted.
     */
    public void projectionChanged(ProjectionEvent pe) {
        if (layer != null) {
            Projection proj = layer.setProjection(pe);
            // proj will be null if the projection hasn't changed, a
            // signal that work does not need to be done.
            if (proj != null) {
                // Some criteria can decide whether
                // starting another thread is worth it...
View Full Code Here

        g.setColor(java.awt.Color.darkGray);
        if (pt1 != null && pt2 != null) {
            // the line connecting the segments
            OMLine cLine = new OMLine(pt1.getLatitude(), pt1.getLongitude(), pt2.getLatitude(), pt2.getLongitude(), lineType);
            // get the map projection
            Projection proj = theMap.getProjection();
            // prepare the line for rendering
            cLine.generate(proj);
            // render the line graphic
            cLine.render(g);
        }
View Full Code Here

                // convert into decimal degrees
                float rad = (float) ProjMath.radToDeg(dRad);
                // make the circle
                OMCircle circle = new OMCircle(pt1.getLatitude(), pt1.getLongitude(), rad);
                // get the map projection
                Projection proj = theMap.getProjection();
                // prepare the circle for rendering
                circle.generate(proj);
                // render the circle graphic
                circle.render(g);
            }
View Full Code Here

            Debug.error("BufferedImageRenderPolicy.paint():  NULL layer, skipping...");
            return;
        }

        OMGraphicList list = layer.getList();
        Projection proj = layer.getProjection();

        if (list != null && layer.isProjectionOK(proj)) {

            if (isUseImageBuffer() && getBuffer() == null) {
                setBuffer(createAndPaintImageBuffer(list));
            }

            BufferedImage bufferedImage = getBuffer();

            if (composite != null) {
                ((Graphics2D) g).setComposite(composite);
            }
           
            setCompositeOnGraphics((Graphics2D)g);
           
            if (bufferedImage != null) {

                if (proj != null) {
                    // Gets reset by JComponent
                    g.setClip(0, 0, proj.getWidth(), proj.getHeight());
                }

                ((Graphics2D) g).drawRenderedImage((BufferedImage) bufferedImage,
                        new AffineTransform());
                if (DEBUG) {
View Full Code Here

     */
    public void projectionChanged(ProjectionEvent e) {
        if (Debug.debugging("scaletextpanel")) {
            System.out.println("ScaleTextPanel.projectionChanged()");
        }
        Projection newProj = e.getProjection();
        if (projection == null || (!projection.equals(newProj))) {
            setProjection((Projection) newProj.makeClone());
        }
    }
View Full Code Here

        super(layer);
    }

    public void paint(Graphics g) {
        if (layer != null && layer.isProjectionOK(layer.getProjection())) {
            Projection proj = layer.getProjection();
            // The proj shouldn't be null, because isProjectionOK
            // checks for that, but that method may be overridden
            if (proj != null) {
                g.setClip(0, 0, proj.getWidth(), proj.getHeight());
            }
        }
        super.paint(g);
    }
View Full Code Here

        OMText currentText;

        // For calculating text locations
        java.awt.Point point;
        LatLonPoint llpoint;
        Projection projection = getProjection();

        if (doLats) {

            // generate other parallels of latitude be creating series
            // of labels
            for (int i = south; i < north; i += stepSize) {
                float lat = (float) i;

                if ((lat % 2) == 0) {
                    if (boxy) {
                        point = projection.forward(lat, west);
                        point.x = 0;
                        llpoint = projection.inverse(point);
                    } else {
                        llpoint = new LatLonPoint(lat, west);
                        while (projection.forward(llpoint).x < 0) {
                            llpoint.setLongitude(llpoint.getLongitude()
                                    + stepSize);
                        }
                    }

                    currentText = new OMText(llpoint.getLatitude(), llpoint.getLongitude(), (int) 2, (int) -2, // Move
                            // them
                            // up a
                            // little
                            Integer.toString((int) lat), font, OMText.JUSTIFY_LEFT);
                    currentText.setLinePaint(textColor);
                    labels.addOMGraphic(currentText);
                }
            }
        }

        // generate labels of longitude
        for (int i = west; i < east; i += stepSize) {
            float lon = (float) i;

            if ((lon % 2) == 0) {
                if (boxy) {
                    point = projection.forward(south, lon);
                    point.y = projection.getHeight();
                    llpoint = projection.inverse(point);
                } else {
                    llpoint = new LatLonPoint(south, lon);
                    while (projection.forward(llpoint).y > projection.getHeight()) {
                        llpoint.setLatitude(llpoint.getLatitude() + stepSize);
                    }
                }

                currentText = new OMText(llpoint.getLatitude(), llpoint.getLongitude(),
View Full Code Here

TOP

Related Classes of com.bbn.openmap.proj.Projection

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.