Package com.bbn.openmap

Examples of com.bbn.openmap.LatLonPoint


        BinaryBufferedFile ssx = new BinaryBufferedFile(ssxFileName);

        ssx.byteOrder(false);
        ssx.seek(100); // skip the file header

        LatLonPoint llp = null;
        if (dataTransform != null) {
            llp = new LatLonPoint();
        }

        while (true) {
            int result = ssx.read(ixRecord, 0, SPATIAL_INDEX_RECORD_LENGTH);
            if (result <= 0) {
                break;// EOF
            } else {
                double xmin = readLEDouble(ixRecord, 8);
                double ymin = readLEDouble(ixRecord, 16);
                double xmax = readLEDouble(ixRecord, 24);
                double ymax = readLEDouble(ixRecord, 32);
                int byteOffset = readBEInt(ixRecord, 0) * 2;

                if (dataTransform != null) {
                    dataTransform.inverse(xmin, ymin, llp);
                    xmin = llp.getLongitude();
                    ymin = llp.getLatitude();
                    dataTransform.inverse(xmax, ymax, llp);
                    xmax = llp.getLongitude();
                    ymax = llp.getLatitude();
                }

                if (Debug.debugging("spatialindexdetail")) {
                    Debug.output("  " + xmin + ", " + ymin + "\n  " + xmax
                            + ", " + ymax);
View Full Code Here


     * @param scale
     */
    public void setScale(float scale) {
        this.scale = scale;

        LatLonPoint center = new LatLonPoint();
        LLXY llxy = new LLXY(center, scale, 2000, 1000);
        Point p1 = llxy.forward(90f, -180f);
        Point p2 = llxy.forward(-90f, 180f);

        int w = (int) (p2.getX() - p1.getX());
View Full Code Here

                startLLP.radlon_,
                endLLP.radlat_,
                endLLP.radlon_,
                numPoints,
                true);
        LatLonPoint llp = new LatLonPoint();
        int size = llpoints.length;
        double losSlope = -MoreMath.HALF_PI;
        for (int i = 0; i < size; i += 2) {
            llp.setLatLon(llpoints[i], llpoints[i + 1], true);
            int height = 0;
            if (i >= size - 2) {
                height = endObjHeight;
            }
            double slope = calculateLOSSlope(startLLP,
View Full Code Here

    }

    public synchronized void render(OMGraphicList gl, boolean forceNew) {
        RoadGraphic visual = getVisual();
        if (visual == null || forceNew) {
            LatLonPoint p1 = road.getWaypoint(index).getLocation();
            LatLonPoint p2 = road.getWaypoint(index + 1).getLocation();
            visual = new Graphic(p1, p2);
            setVisual(visual);
        }
        gl.addOMGraphic((Graphic) visual);
    }
View Full Code Here

            // 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();

                    // check... dfd
                    if (minuteSpacing == 2) {
                        lon += 180.;
                    } else {
                        if (lon < 0.)
                            lon += 360.;
                    }

                    // find indicies
                    int lat_idx = (int) ((90. - lat) * scy);
                    int lon_idx = (int) (lon * scx);

                    // offset
                    int ofs = lon_idx + lat_idx * bufferWidth;

                    // make a color
                    int idx = 0;
                    int gray = 0;
                    try {

                        // get elevation
                        short el = dataBuffer[ofs];

                        // slope
                        byte sl = slopeMap[ofs];

                        // our index
                        idx = y * width + x;

                        // create a color
                        Color pix = null;
                        if (viewType == SLOPESHADING) {
                            // HACK (see method description above)
                            if ((llp.getLatitude() == center.getLatitude())
                                    && (llp.getLongitude() == center.getLongitude()))
                                gray = 0;
                            else
                                gray = 127 + sl;
                            pix = new Color(gray, gray, gray, opaqueness);
                        } else if (viewType == COLOREDSHADING) {
                            // HACK (see method description above)
                            if ((llp.getLatitude() == center.getLatitude())
                                    && (llp.getLongitude() == center.getLongitude()))
                                pix = new Color(0, 0, 0, opaqueness);
                            else
                                pix = getColor(el, sl);
                        }

View Full Code Here

                    SERVER_NOTIFICATION_MASK)) {
                return false;
            }

            // Get the lat/lon point of the event
            LatLonPoint llpoint = getProjection().inverse(e.getX(), e.getY());

            // Don't need these anymore, look below for explaination
            // for asynchronous operation.
            // LinkActionList lal;
            // LinkActionRequest lar;

            ClientLink l = linkManager.getLink(false);

            // We'll check this here because we don't want to wait if
            // it is not available - it could be used for another
            // graphics or gui fetch.
            if (l == null) {
                Debug.message("link",
                        "LinkLayer: unable to get link in handleGesture().");
                return false;
            }

            // Using the link - carefully prevent others from using it
            // too!
            synchronized (l) {
                if (id != null) {
                    args.setProperty(LPC_GRAPHICID, id);
                } else {
                    // Reset this to prevent sending the id of a graphic
                    // that is not being clicked on.
                    args.remove(LPC_GRAPHICID);
                }

                // Send the query
                LinkActionRequest.write(descriptor,
                        e,
                        llpoint.getLatitude(),
                        llpoint.getLongitude(),
                        args,
                        l);

            }
View Full Code Here

     * @return Point p
     * 
     */
    private Point edge_point(Point p, float current_azimuth) {
        float c = HEMISPHERE_EDGE;
        LatLonPoint tmpll = GreatCircle.spherical_between(ctrLat,
                ctrLon,
                c/*-epsilon*/,
                current_azimuth);
        float phi = tmpll.radlat_;
        float lambda = tmpll.radlon_;
View Full Code Here

     * Check if equator is visible on screen.
     *
     * @return boolean
     */
    public boolean overEquator() {
        LatLonPoint llN = inverse(width / 2, 0, new LatLonPoint());
        LatLonPoint llS = inverse(width / 2, height, new LatLonPoint());
        return MoreMath.sign(llN.radlat_) != MoreMath.sign(llS.radlat_);
    }
View Full Code Here

     * screen.
     *
     * @return LatLonPoint
     */
    public LatLonPoint getUpperLeft() {
        LatLonPoint tmp = new LatLonPoint();
        float lat, lon;

        // over north pole
        if (overNorthPole()) {
            lat = NORTH_POLE;
            lon = -DATELINE;
        }

        // over south pole
        else if (overSouthPole()) {
            lon = -DATELINE;
            if (overEquator()) {
                // get top center for latitude
                tmp = inverse(width / 2, 0, tmp);
                lat = tmp.radlat_;
            } else {
                // get left top corner for latitude
                tmp = inverse(0, 0, tmp);
                lat = tmp.radlat_;
            }
        }

        // view in northern hemisphere
        else if (ctrLat >= 0f) {
            // get left top corner for longitude
            tmp = inverse(0, 0, tmp);
            lon = tmp.radlon_;
            // get top center for latitude
            tmp = inverse(width / 2, 0, tmp);
            lat = tmp.radlat_;
        }

        // view in southern hemisphere
        else {
            // get left bottom corner for longitude
            tmp = inverse(0, height, tmp);
            lon = tmp.radlon_;

            if (overEquator()) {
                // get top center (for latitude)
                tmp = inverse(width / 2, 0, tmp);
                lat = tmp.radlat_;
            } else {
                // get left top corner (for latitude)
                tmp = inverse(0, 0, tmp);
                lat = tmp.radlat_;
            }
        }
        tmp.setLatLon(lat, lon, true);
        //      Debug.output("ul="+tmp);
        return tmp;
    }
View Full Code Here

     * complicated for azimuthal projections.
     *
     * @return LatLonPoint
     */
    public LatLonPoint getLowerRight() {
        LatLonPoint tmp = new LatLonPoint();
        float lat, lon;

        // over north pole
        if (overNorthPole()) {
            lon = DATELINE;
            if (overEquator()) {
                // get bottom center for latitude
                tmp = inverse(width / 2, height, tmp);
                lat = tmp.radlat_;
            } else {
                // get bottom right corner for latitude
                tmp = inverse(width, height, tmp);
                lat = tmp.radlat_;
            }
        }

        // over south pole
        else if (overSouthPole()) {
            lat = SOUTH_POLE;
            lon = DATELINE;
        }

        // view in northern hemisphere
        else if (ctrLat >= 0f) {
            // get the right top corner for longitude
            tmp = inverse(width, 0, tmp);
            lon = tmp.radlon_;

            if (overEquator()) {
                // get the bottom center (for latitude)
                tmp = inverse(width / 2, height, tmp);
                lat = tmp.radlat_;
            } else {
                // get the right bottom corner (for latitude)
                tmp = inverse(width, height, tmp);
                lat = tmp.radlat_;
            }
        }

        // view in southern hemisphere
        else {
            // get the right bottom corner for longitude
            tmp = inverse(width, height, tmp);
            lon = tmp.radlon_;
            // get bottom center for latitude
            tmp = inverse(width / 2, height, tmp);
            lat = tmp.radlat_;
        }
        tmp.setLatLon(lat, lon, true);
        //      Debug.output("lr="+tmp);
        return tmp;
    }
View Full Code Here

TOP

Related Classes of com.bbn.openmap.LatLonPoint

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.