本文整理汇总了Java中com.jhlabs.map.proj.ProjectionFactory类的典型用法代码示例。如果您正苦于以下问题:Java ProjectionFactory类的具体用法?Java ProjectionFactory怎么用?Java ProjectionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectionFactory类属于com.jhlabs.map.proj包,在下文中一共展示了ProjectionFactory类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initializeTable
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
/**
* compute the distortion parameters for all supported projections
*/
private void initializeTable() {
List<String> projNames = ProjectionsManager.getSelectedProjectionNames();
for (String name : projNames) {
try {
Projection projection = ProjectionFactory.getNamedProjection(name);
projection.initialize();
QModel qModel = this.model.getDisplayModel().qModel;
ProjectionDistortionParameters params;
params = new ProjectionDistortionParameters(projection, qModel);
synchronized (model.getDisplayModel().distParams) {
model.getDisplayModel().distParams.add(params);
}
// this will call process() in the Event Dispatch Thread to
// update the table.
this.publish();
} catch (Exception e) {
System.err.println("Could not initialize " + name + " projection.");
e.printStackTrace();
}
}
}
开发者ID:OSUCartography,项目名称:FlexProjector,代码行数:28,代码来源:TableFiller.java
示例2: TileMap
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
public TileMap(String path)
{
super(path);
datum = "WGS84";
projection = ProjectionFactory.fromPROJ4Specification("+proj=merc".split(" "));
projection.setEllipsoid(Ellipsoid.WGS_1984);
projection.initialize();
zoom = 1.;
dynZoom = 1.;
srcZoom = 14;
defZoom = 14;
lastLatitude = 0.;
recalculateMPP();
}
开发者ID:andreynovikov,项目名称:androzic-library,代码行数:18,代码来源:TileMap.java
示例3: ProjectionSelectionPanel
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
/**
* Creates new form ProjectionSelectionPanel
*/
public ProjectionSelectionPanel() {
initComponents();
Object[] projNames = ProjectionFactory.getOrderedProjectionNames();
projectionComboBox.setModel(new DefaultComboBoxModel(projNames));
}
开发者ID:OSUCartography,项目名称:JMapProjLib,代码行数:10,代码来源:ProjectionSelectionPanel.java
示例4: project
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
private void project() {
boolean inverse = inverseCheckBox.isSelected();
try {
// find the selected name, create the corresponding projection.
String projName = (String) projectionComboBox.getSelectedItem();
Projection projection = ProjectionFactory.getNamedProjection(projName);
// use the selected projection to project the lines,
// and pass the projected lines to the map to display.
if (projection != null) {
projection.setProjectionLongitudeDegrees(lon0Slider.getValue());
projection.setEllipsoid(Ellipsoid.SPHERE);
projection.initialize();
LineProjector projector = new LineProjector();
ArrayList<MapLine> projectedLines = new ArrayList<>();
projector.constructGraticule(projectedLines, projection);
projector.projectLines(lines, projectedLines, projection);
if (inverse && projection.hasInverse()) {
projectedLines = projector.inverse(projectedLines, projection);
}
map.setLines(projectedLines);
} else {
map.setLines(null);
}
// write some descriptive information about the selected projection.
updateProjectionInfo(projection);
} catch (Exception exc) {
String msg = exc.getMessage();
String title = "Error";
JOptionPane.showMessageDialog(selectionPanel, msg, title, JOptionPane.ERROR_MESSAGE);
Logger.getLogger(ProjectionSelectionPanel.class.getName()).log(Level.SEVERE, null, exc);
}
}
开发者ID:OSUCartography,项目名称:JMapProjLib,代码行数:39,代码来源:ProjectionSelectionPanel.java
示例5: deserializeFromString
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
@Override
public void deserializeFromString(String string) {
// make sure we have a file in Flex Projector format
if (!string.startsWith(FORMAT_IDENTIFIER)) {
throw new IllegalArgumentException();
}
StringTokenizer tokenizer = new StringTokenizer(string, "\n\r");
// overread format identifier
tokenizer.nextToken();
// overread "Vertical Scale"
tokenizer.nextToken();
vScale = Double.parseDouble(tokenizer.nextToken());
// overread "Global Scale"
tokenizer.nextToken();
scale = Double.parseDouble(tokenizer.nextToken());
// overread "Weight"
tokenizer.nextToken();
weight = Double.parseDouble(tokenizer.nextToken());
// overread "Projection 1"
tokenizer.nextToken();
String proj1Name = tokenizer.nextToken();
p1 = ProjectionFactory.getNamedProjection(proj1Name);
// overread "Projection 2"
tokenizer.nextToken();
String proj2Name = tokenizer.nextToken();
p2 = ProjectionFactory.getNamedProjection(proj2Name);
}
开发者ID:OSUCartography,项目名称:FlexProjector,代码行数:36,代码来源:MeanProjection.java
示例6: setBackgroundProjection
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
public void setBackgroundProjection(String name) {
final com.jhlabs.map.proj.Projection projection;
if (name.startsWith("Flex Projection")) {
projection = ProjectionBrewerPanel.loadFlexProjection();
} else {
projection = ProjectionFactory.getNamedProjection(name);
}
if (projection == null) {
// problem finding the projection, revert to the previous one.
String previousName = model.getDisplayModel().projection.toString();
secondProjectionComboBox.setSelectedItem(previousName);
return;
}
model.getDisplayModel().projection = projection;
if (updatingGUI == false) {
model.getDisplayModel().showSecondProjection = true;
}
if (distortionProfilesManager != null) {
distortionProfilesManager.setShowBackgroundProfiles(true);
distortionProfilesManager.setBackgroundProjection(model.getDisplayModel().projection);
}
try {
updatingGUI = true;
writeDisplayGUI();
} finally {
updatingGUI = false;
}
// inform listeners
Projection foreProj = model.getDesignProjection();
designProjectionChangeListeners.announce().designProjectionChanged(foreProj);
}
开发者ID:OSUCartography,项目名称:FlexProjector,代码行数:37,代码来源:ProjectionBrewerPanel.java
示例7: transformBboxJavaProj
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
/**
* Reproject bounding box using javaProj library. Slower and not so stable
* than Proj.4 but does not require NDK
*
* @param bbox
* input bounding box
* @param fromProj
* proj4 text
* @param toProj
* @return projected bounding box
*/
public static Envelope transformBboxJavaProj(Envelope bbox, String fromProj,
String toProj) {
// first A->B, convert to wgs84
Projection projection = ProjectionFactory
.fromPROJ4Specification(fromProj.split(" "));
com.jhlabs.map.Point2D.Double minB = new com.jhlabs.map.Point2D.Double(
bbox.getMinX(), bbox.getMinY());
com.jhlabs.map.Point2D.Double maxB = new com.jhlabs.map.Point2D.Double(
bbox.getMaxX(), bbox.getMaxY());
// if proj A already Wgs84, then skip
if(!projection.toString().equals("Null")){
com.jhlabs.map.Point2D.Double minA = new com.jhlabs.map.Point2D.Double(
bbox.getMinX(), bbox.getMinY());
com.jhlabs.map.Point2D.Double maxA = new com.jhlabs.map.Point2D.Double(
bbox.getMaxX(), bbox.getMaxY());
minB = new com.jhlabs.map.Point2D.Double();
maxB = new com.jhlabs.map.Point2D.Double();
projection.inverseTransform(minA, minB);
projection.inverseTransform(maxA, maxB);
}
// then B->C from Wgs84 to Layer SRID
Projection projection2 = ProjectionFactory
.fromPROJ4Specification(toProj.split(" "));
if(!projection2.toString().equals("Null")){
com.jhlabs.map.Point2D.Double minC = new com.jhlabs.map.Point2D.Double();
com.jhlabs.map.Point2D.Double maxC = new com.jhlabs.map.Point2D.Double();
projection2.transform(minB, minC);
projection2.transform(maxB, maxC);
return new Envelope(minC.x, maxC.x, minC.y, maxC.y);
} else {
// dest already wgs84, no convert B->C
return new Envelope(minB.x, maxB.x, minB.y, maxB.y);
}
}
开发者ID:FAIMS,项目名称:faims-android,代码行数:52,代码来源:GeoUtils.java
示例8: deserializeFromString
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
@Override
public void deserializeFromString(String string) {
// make sure we have a file in Flex Projector format
if (!string.startsWith(FORMAT_IDENTIFIER)) {
throw new IllegalArgumentException();
}
StringTokenizer tokenizer = new StringTokenizer(string, "\n\r");
// overread format identifier
tokenizer.nextToken();
// overread "Vertical Scale"
tokenizer.nextToken();
setVerticalScale(Double.parseDouble(tokenizer.nextToken()));
// overread "Global Scale"
tokenizer.nextToken();
setScale(Double.parseDouble(tokenizer.nextToken()));
// overread "Pole Scale"
tokenizer.nextToken();
double ps = Double.parseDouble(tokenizer.nextToken());
setPoleScale(ps);
setAutomaticScale(ps == -1.);
// overread "Latitude"
tokenizer.nextToken();
setLatitude(Double.parseDouble(tokenizer.nextToken()));
// overread "Tolerance"
tokenizer.nextToken();
setTolerance(Double.parseDouble(tokenizer.nextToken()));
// overread "Projection 1"
tokenizer.nextToken();
String proj1Name = tokenizer.nextToken();
setProjection1(ProjectionFactory.getNamedProjection(proj1Name));
// overread "Projection 2"
tokenizer.nextToken();
String proj2Name = tokenizer.nextToken();
setProjection2(ProjectionFactory.getNamedProjection(proj2Name));
}
开发者ID:OSUCartography,项目名称:FlexProjector,代码行数:46,代码来源:LatitudeMixerProjection.java
示例9: deserializeFromString
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
@Override
public void deserializeFromString(String string) {
// make sure we have a file in Flex Projector format
if (!string.startsWith(FORMAT_IDENTIFIER)) {
throw new IllegalArgumentException();
}
StringTokenizer tokenizer = new StringTokenizer(string, "\n\r");
// overread format identifier
tokenizer.nextToken();
// overread "Global Scale"
tokenizer.nextToken();
setScale(Double.parseDouble(tokenizer.nextToken()));
// overread "Vertical Scale"
tokenizer.nextToken();
setVerticalScale(Double.parseDouble(tokenizer.nextToken()));
// overread "Length Weight"
tokenizer.nextToken();
setLengthW(Double.parseDouble(tokenizer.nextToken()));
// overread "Distance Weight"
tokenizer.nextToken();
setDistanceW(Double.parseDouble(tokenizer.nextToken()));
// overread "Bending Weight"
tokenizer.nextToken();
setBendingW(Double.parseDouble(tokenizer.nextToken()));
// overread "Meridians Weight"
tokenizer.nextToken();
setMeridiansW(Double.parseDouble(tokenizer.nextToken()));
// overread "Projection 1"
tokenizer.nextToken();
String proj1Name = tokenizer.nextToken();
p1 = ProjectionFactory.getNamedProjection(proj1Name);
// overread "Projection 2"
tokenizer.nextToken();
String proj2Name = tokenizer.nextToken();
p2 = ProjectionFactory.getNamedProjection(proj2Name);
}
开发者ID:OSUCartography,项目名称:FlexProjector,代码行数:48,代码来源:FlexMixProjection.java
示例10: main
import com.jhlabs.map.proj.ProjectionFactory; //导入依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Projection aProj = ProjectionFactory.getNamedPROJ4CoordinateSystem("nad83:2001");
Point2D.Double aSrc = new Point2D.Double(240678.76, 886748.07);
Point2D.Double aDst = new Point2D.Double();
aProj.inverseTransform(aSrc, aDst);
System.out.println(aDst.x);
System.out.println(aDst.y);
}
开发者ID:codeforboston,项目名称:ungentry,代码行数:19,代码来源:Conversion.java
注:本文中的com.jhlabs.map.proj.ProjectionFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论