📄 cylindrical.java
字号:
// **********************************************************************// // <copyright>// // BBN Technologies// 10 Moulton Street// Cambridge, MA 02138// (617) 873-8000// // Copyright (C) BBNT Solutions LLC. All rights reserved.// // </copyright>// **********************************************************************// // $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/proj/Cylindrical.java,v $// $RCSfile: Cylindrical.java,v $// $Revision: 1.5.2.2 $// $Date: 2005/08/09 21:17:54 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.proj;import java.awt.*;import java.util.ArrayList;import com.bbn.openmap.LatLonPoint;import com.bbn.openmap.MoreMath;import com.bbn.openmap.util.Debug;/** * Base of all cylindrical projections. * <p> * * @see Projection * @see Proj * @see Mercator * @see CADRG * */public abstract class Cylindrical extends Proj { // used for calculating wrapping of ArrayList graphics protected Point world; // world width in pixels. protected int half_world; // world.x / 2 /** * Construct a cylindrical projection. * <p> * * @param center LatLonPoint center of projection * @param scale float scale of projection * @param width width of screen * @param height height of screen * @param type projection type * */ public Cylindrical(LatLonPoint center, float scale, int width, int height, int type) { super(center, scale, width, height, type); } /** * Return stringified description of this projection. * <p> * * @return String * @see Projection#getProjectionID */ public String toString() { return " world(" + world.x + "," + world.y + ")" + super.toString(); } /** * Called when some fundamental parameters change. * <p> * Each projection will decide how to respond to this change. For * instance, they may need to recalculate "constant" parameters * used in the forward() and inverse() calls. * <p> */ protected void computeParameters() { planetPixelRadius = planetRadius * pixelsPerMeter; planetPixelCircumference = MoreMath.TWO_PI * planetPixelRadius; // minscale is the minimum scale allowable (before integer // wrapping // can occur) minscale = (float) Math.ceil(planetPixelCircumference / (int) Integer.MAX_VALUE); if (minscale < 1) minscale = 1; if (scale < minscale) scale = minscale; // maxscale = scale at which world circumference fits in // window maxscale = (float) planetPixelCircumference / (float) width; if (maxscale < minscale) { maxscale = minscale; } if (scale > maxscale) { scale = maxscale; } scaled_radius = planetPixelRadius / scale; if (world == null) world = new Point(0, 0); // width of the world in pixels at current scale world.x = (int) (planetPixelCircumference / scale); half_world = world.x / 2; // calculate cutoff scale for XWindows workaround XSCALE_THRESHOLD = (int) (planetPixelCircumference / 64000);//fudge // it a // little // bit if (Debug.debugging("proj")) { Debug.output("Cylindrical.computeParameters(): " + "world.x = " + world.x + " half_world = " + half_world + " XSCALE_THRESHOLD = " + XSCALE_THRESHOLD); } } /** * Pan the map/projection. * <ul> * <li><code>pan(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -