Examples of Projection


Examples of com.bbn.openmap.proj.Projection

    /**
     * The main method call in the ScenarioGraphicLoader that actually
     * modifies the OMGraphics and updates the map.
     */
    public synchronized void manageGraphics() {
        Projection p = getProjection();
        OMGraphicHandler receiver = getReceiver();
        boolean DEBUG = Debug.debugging("scenario");
        if (receiver != null && p != null) {
            if (scenarioGraphics == null) {
                scenarioGraphics = createData();
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

        if (sourceMap == null) {
            sourceMap = (MapBean) projEvent.getSource();
            map.setBckgrnd(sourceMap.getBckgrnd());
        }

        Projection proj = projEvent.getProjection();
        if (proj == null) {
            return;
        }

        if (statusLayer != null
                && statusLayer instanceof OverviewMapStatusListener) {
            ((OverviewMapStatusListener) statusLayer).setSourceMapProjection(proj);
        }

        float newScale = proj.getScale() * scaleFactor;

        // Adjust the newScale based on the ratio of the
        // source projection width and the overview
        // map projection width.
        Projection sourceProj = sourceMap.getProjection();
        newScale *= (float) sourceProj.getWidth()
                / (float) projection.getWidth();

        if (newScale < minScale) {
            newScale = minScale;
        }
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

     *
     * @param setting the scale setting - 1:setting
     */
    public void setMinScale(float width, Length uom) {
        if (width > 0) {
            Projection p = map.getProjection();

            // This is really not the radius but the half width.
            float radius = ProjMath.radToDeg(uom.toRadians(width)) / 2;

            LatLonPoint left = (LatLonPoint) p.getCenter().clone();
            LatLonPoint right = (LatLonPoint) p.getCenter().clone();
            left.setLongitude(left.getLongitude() - radius);
            right.setLongitude(right.getLongitude() + radius);

            minScale = ProjMath.getScale(left, right, p);
        }
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

        Point p1 = llxy.forward(90f, -180f);
        Point p2 = llxy.forward(-90f, 180f);

        int w = (int) (p2.getX() - p1.getX());
        int h = (int) (p2.getY() - p1.getY());
        Projection proj = new LLXY(center, scale, w, h);
        setProj(proj);

        if (DEBUG) {
            Debug.output("Created projection " + proj + " from " + p1 + ", "
                    + p2);
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

    public void moveTo(Point loc) {}

    public RoadPoint addRoadPoint(int x, int y) {
        RoadLayer layer = road.getRoadLayer();
        Projection p = layer.getProjection();
        RoadPoint rp = new RoadPoint(road, p.inverse(x, y), layer);
        road.insertRoadPointAt(rp, index + 1);
        return rp;
    }
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

     * @return a projection created from the properties. A mercator projection
     *         is created if no properties pertaining to a projection are found.
     */
    protected Projection initProjection(Properties props) {
        loadProjections(props);
        Projection proj = ProjectionFactory.getDefaultProjectionFromEnvironment();

        if (Debug.debugging("imageserver")) {
            Debug.output("MRH starting with default projection = " + proj);
        }
        return proj;
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

     * its variants raise an exception for "Outer Space" values.
     */
    protected OMRaster buildRaster() {
        // initialize the return
        OMRaster ret = null;
        Projection projection = getProjection();
        // work with the slopeMap
        if (slopeMap != null) {

            // compute our deltas
            int width = projection.getWidth();
            int height = projection.getHeight();

            // create int array to hold colors
            int[] colors = new int[width * height];

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

            // starting and ending indices
            int sx = 0, sy = 0, ex = width, ey = height;

            // 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
            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
                    float lat = llp.getLatitude();
                    float lon = llp.getLongitude();

View Full Code Here

Examples of com.bbn.openmap.proj.Projection

        if (isCancelled()) {
            Debug.message("etopo", getName()
                    + "|ETOPOLayer.prepare(): aborted.");
            return null;
        }
        Projection projection = getProjection();
        if (projection == null) {
            Debug.error("ETOPO Layer needs to be added to the MapBean before it can draw images!");
            return new OMGraphicList();
        }

        // load the buffer
        if (dataBuffer == null || spacingReset) {
            loadBuffer();
            spacingReset = false;
            slopeReset = true;
        }

        // re-do the slope map
        if (slopeReset) {
            buildSlopeMap();
            slopeReset = false;
        }

        Debug.message("basic", getName() + "|ETOPOLayer.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("etopo")) {
            Debug.output(getName() + "|ETOPOLayer.prepare(): "
                    + "calling getRectangle " + " with projection: "
                    + projection + " ul = " + projection.getUpperLeft()
                    + " lr = " + projection.getLowerRight());
        }

        // build graphics list
        OMGraphicList omGraphicList = new OMGraphicList();
        omGraphicList.addOMGraphic(buildRaster());
View Full Code Here

Examples of com.bbn.openmap.proj.Projection

     * @return OMGraphicList
     */
    public synchronized OMGraphicList prepare() {

        OMGraphicList list = getList();
        Projection projection = getProjection();

        if (projection == null) {
            Debug.message("basic", "ShapeLayer|" + getName()
                    + ": prepare called with null projection");
            return new OMGraphicList();
        }

        if (spatialIndex == null) {
            Debug.message("shape", "ShapeLayer: spatialIndex is null!");

            if (list != null) {
                list.generate(projection, true);// all new graphics
                return list;
            } else {
                // What we'd really like to do is make this a buffered layer at
                // this point, if we can't find an ssx file and can't create
                // one.
                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();

        if (list != null) {
            list.clear();
            list = new OMGraphicList();
        }

        // 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("ShapeLayer.computeGraphics(): Dateline is on screen");
            }

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

Examples of com.bbn.openmap.proj.Projection

     * return out of the prepare asap.
     *
     * @return a list of graphics.
     */
    public synchronized OMGraphicList prepare() {
        Projection projection = getProjection();
        if (projection != null) {
            extraGraphics.generate(projection);
        }
        return super.prepare();
    }
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.