Examples of Projection


Examples of com.bbn.openmap.proj.Projection

            if (!(obj instanceof MapBean) || !autoZoom || point1 == null
                    || point2 == null)
                return;

            MapBean map = (MapBean) obj;
            Projection projection = map.getProjection();
            Proj p = (Proj) projection;

            synchronized (this) {
                point2 = getRatioPoint((MapBean) e.getSource(),
                        point1,
                        e.getPoint());
                int dx = Math.abs(point2.x - point1.x);
                int dy = Math.abs(point2.y - point1.y);

                // Dont bother redrawing if the rectangle is too small
                if ((dx < 5) || (dy < 5)) {
                    // clean up the rectangle, since point2 has the
                    // old value.
                    paintRectangle(map, point1, point2);

                    // If rectangle is too small in both x and y then
                    // recenter the map
                    if ((dx < 5) && (dy < 5)) {
                        LatLonPoint llp = projection.inverse(e.getPoint());

                        boolean shift = e.isShiftDown();
                        boolean control = e.isControlDown();

                        if (control) {
                            if (shift) {
                                p.setScale(p.getScale() * 2.0f);
                            } else {
                                p.setScale(p.getScale() / 2.0f);
                            }
                        }

                        // reset the points here so the point doesn't
                        // get rendered on the repaint.
                        point1 = null;
                        point2 = null;

                        p.setCenter(llp);
                        map.setProjection(p);
                    }
                    return;
                }

                // Figure out the new scale
                dx = Math.abs(point2.x - point1.x);
                dy = Math.abs(point2.y - point1.y);

                // cornerPoint 1 should be the upper left.
                Point cornerPoint1 = new Point(point2.x < point1.x ? point2.x
                        : point1.x, point2.y < point1.y ? point2.y : point1.y);
                Point cornerPoint2 = new Point(cornerPoint1.x + 2 * dx, cornerPoint1.y
                        + 2 * dy);

                float newScale = com.bbn.openmap.proj.ProjMath.getScale(cornerPoint1,
                        cornerPoint2,
                        projection);

                // Figure out the center of the rectangle
                com.bbn.openmap.LatLonPoint center = projection.inverse(point1.x,
                        point1.y);

                // Set the parameters of the projection and then set
                // the projection of the map. This way we save having
                // the MapBean fire two ProjectionEvents.
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

            Debug.error(ioe.getMessage());
            return list;
        }

        // grab local
        Projection proj = getProjection();

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

        // 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, proj.getScale())) {
            if (Debug.debugging("shape")) {
                Debug.output("ShapeLayer.computeGraphics(): Dateline is on screen");
            }

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

Examples of com.bbn.openmap.proj.Projection

     *
     */
    protected OMRaster buildRaster() {
        // initialize the return
        OMRaster ret = null;
        Projection projection = getProjection();
        // work with the slopeMap
        if (slopeMap != null) {
           
            // compute our deltas
            int pixelColumns = projection.getWidth();
            int pixelRows = projection.getHeight();

            // create int array to hold colors
            int[] colors = new int[pixelColumns * pixelRows];

            // compute scalers for lat/lon indicies
            float yPixPerDataPt = (float) bufferHeight / 180F;
            float xPixPerDataPt = (float) bufferWidth / 360F;

            // starting and ending indices
            int sx = 0, sy = 0, ex = pixelColumns, ey = pixelRows;

            // handle CADRG
            if (projection instanceof CADRG) {

                                // get corners
                LatLonPoint ul = projection.getUpperLeft();
                LatLonPoint lr = projection.getLowerRight();

                                // set start/end indicies
                Point ulp = projection.forward(ul);
                Point lrp = projection.forward(lr);
                sx = (int) ulp.getX();
                ex = (int) lrp.getX();
                sy = (int) ulp.getY();
                ey = (int) lrp.getY();

            }

            // get the center lat/lon (used by the HACK, see above in
            // method description)
            LatLonPoint center = projection.getCenter();
            LatLonPoint llp = new LatLonPoint();

            // build array
            float lat;
            float lon;
            int lat_idx;
            int lon_idx;
            float latWt;
            float lonWt;

            // offset
            int ofs;
            int ofsRight;
            int ofsDown;
            int ofsDownRight;

            for (int y = sy; y < ey; y++) {


                                // process each column
                for (int x = sx; x < ex; x++) {

                    // inverse project x,y to lon,lat
                    projection.inverse(x, y, llp);

                    // get point values
                    lat = llp.getLatitude();
                    lon = llp.getLongitude();

View Full Code Here

Examples of com.bbn.openmap.proj.Projection

     * @param newPoints populated with points on the route.
     * @param segments populated with Segments.
     */
    protected void populatePointsAndSegments(Route bestRoute, List newPoints,
                                             List segments) {
        Projection proj = getProjection();

        Intersection origin = bestRoute.getOriginIntersection();
        // Intersection dest = bestRoute.getDestinationIntersection();

        if (logger.isLoggable(Level.INFO))
            logger.info("adding " + bestRoute.roads.length + " new roads.");

        Road road = null;

        Intersection from = origin, to = null;

        Set loopSet = new HashSet();
        if (doLoopCheck)
            loopSet.add(origin);
        Set ptSet = new HashSet();
        for (int i = 0; i < bestRoute.roads.length; i++) {
            road = bestRoute.roads[i];

            if (!from.equals(road.getFirstIntersection())
                    && !from.equals(road.getSecondIntersection())) {
                logger.severe("huh? " + from
                        + " is not an intersection on road " + road);
            }

            Point pt = createPoint(proj.forward(from.getLocation()));

            if (doLoopCheck) {
                if (ptSet.contains(pt)) {
                    logger.warning("pt set has duplicate at " + pt);
                }
                ptSet.add(pt);
            }

            newPoints.add(pt);
            to = road.getOtherIntersection(from);
            if (doLoopCheck) {
                if (loopSet.contains(to)) {
                    logger.warning("road has a cycle at " + to);
                }
                loopSet.add(to);
            }

            // check to see if we need to reverse the order of the
            // road points,
            // which may not be ordered the same as the previous road

            boolean reverse = from.equals(road.getSecondIntersection());
            Segment path = getPathSegment(proj, road, reverse);

            if (logger.isLoggable(Level.INFO))
                logger.info("created path " + path);

            segments.add(path);

            from = to;
        }

        Point pt = createPoint(proj.forward(to.getLocation()));
        if (ptSet.contains(pt)) {
            logger.warning("pt set has duplicate at " + pt);
        }

        newPoints.add(pt);
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

            Debug.message("link", getName()
                    + "|BufferedLinkLayer.prepare(): aborted.");
            return null;
        }

        Projection projection = getProjection();

        if (projection == null) {
            System.err.println("Link Layer needs to be added to the MapBean before it can get graphics!");
            return new LinkOMGraphicList();
        }
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

    public boolean mousePressed(MouseEvent e) {
        return false;
    }

    public boolean mouseReleased(MouseEvent e) {
        Projection projection = getProjection();
        LatLonPoint ll = projection.inverse(e.getX(), e.getY());
        location = new DTEDLocation(e.getX(), e.getY());
        location.setElevation(cache.getElevation(ll.getLatitude(),
                ll.getLongitude()));
        location.generate(projection);
        repaint();
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

     */
    public void projectionChanged(ProjectionEvent ev) {
        // Lets the ScaleFilterLayer remember the projection, just in case.
        setProjection(ev);

        Projection proj = ev.getProjection();
        // get the appropriate layer and invoke projectionChanged
        Layer layer = configureAppropriateLayer(proj.getScale());

        fireStatusUpdate(LayerStatusEvent.START_WORKING);
        layer.projectionChanged(ev);
    }
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

        // Need to grab a copy of the old projection in case
        // saveGraphicsForRedraw is true and the projection changes,
        // so we can test to see if the zone and scale have changed,
        // testing for reuse of current frames.
        Projection oldProj = getProjection();
        Projection newProj = setProjection(e);

        if (newProj == null) {
            // Projection didn't change, nothing to do, already have
            // good graphics and just need to paint...
            repaint();
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

        if (this.cache == null) {
            Debug.message("rpf", getName() + "|RpfLayer: Creating cache!");
            this.cache = new RpfCacheManager(frameProvider, viewAttributes, subframeCacheSize, auxSubframeCacheSize);
        }

        Projection projection = getProjection();

        if (coverage != null && coverage.isInUse()) {
            coverage.prepare(frameProvider,
                    projection,
                    viewAttributes.chartSeries);
        }

        // Check to make sure the projection is CADRG
        if (!(projection instanceof EqualArc)
                && (viewAttributes.showMaps || viewAttributes.showInfo)) {
            fireRequestInfoLine("RpfLayer requires an Equal Arc projection (CADRG/LLXY) for images or attributes!");
            return null;
        }

        Debug.message("basic", getName() + "|RpfLayer.prepare(): doing it");

        // Setting the OMGraphicsList for this layer. Remember, the
        // OMGraphicList is made up of OMGraphics, which are generated
        // (projected) when the graphics are added to the list. So,
        // after this call, the list is ready for painting.

        // call getRectangle();
        if (Debug.debugging("rpf")) {
            Debug.output(getName() + "|RpfLayer.prepare(): "
                    + "calling getRectangle " + " with projection: "
                    + projection + " ul = " + projection.getUpperLeft()
                    + " lr = " + projection.getLowerRight());
        }

        if (frameProvider.needViewAttributeUpdates()) {
            frameProvider.setViewAttributes(viewAttributes);
        }

        Projection cadrgProj = projection;
        if (!(projection instanceof CADRG)) {
            cadrgProj = new CADRG(projection.getCenter(), projection.getScale(), projection.getWidth(), projection.getHeight());

            Point ulp = cadrgProj.forward(projection.getUpperLeft());
            Point lrp = cadrgProj.forward(projection.getLowerRight());

            int w = (int) Math.abs(lrp.getX() - ulp.getX());
            int h = (int) Math.abs(lrp.getY() - ulp.getY());

            // float cadrgScale =
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

            }
            return null;
        }

        Vector omGraphicList = new Vector();
        Projection projection = getProjection();
        if (projection == null) {
            if (Debug.debugging("location")) {
                Debug.output(getName()
                        + "|LocationLayer.prepare(): null projection, layer not ready.");
            }
            return omGraphicList;
        }

        if (Debug.debugging("location")) {
            Debug.output(getName() + "|LocationLayer.prepare(): doing it");
        }

        if (useDeclutterMatrix && declutterMatrix != null) {
            declutterMatrix.setWidth(projection.getWidth());
            declutterMatrix.setHeight(projection.getHeight());
            declutterMatrix.create();
        }

        // Setting the OMGraphicsList for this layer. Remember, the
        // Vector is made up of OMGraphics, which are generated
        // (projected) when the graphics are added to the list. So,
        // after this call, the list is ready for painting.

        // call getRectangle();
        if (Debug.debugging("location")) {
            Debug.output(getName() + "|LocationLayer.prepare(): "
                    + "calling prepare with projection: " + projection
                    + " ul = " + projection.getUpperLeft() + " lr = "
                    + projection.getLowerRight());
        }

        LatLonPoint ul = projection.getUpperLeft();
        LatLonPoint lr = projection.getLowerRight();

        if (Debug.debugging("location")) {
            float delta = lr.getLongitude() - ul.getLongitude();
            Debug.output(getName() + "|LocationLayer.prepare(): " + " ul.lon ="
                    + ul.getLongitude() + " lr.lon = " + lr.getLongitude()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.