本文整理汇总了Java中org.meteoinfo.legend.MapFrame类的典型用法代码示例。如果您正苦于以下问题:Java MapFrame类的具体用法?Java MapFrame怎么用?Java MapFrame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapFrame类属于org.meteoinfo.legend包,在下文中一共展示了MapFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: display
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Dislay
*
* @param varName Variable name
*/
public void display(String varName) {
if (!this.isMap)
this.map();
if (currentDataInfo.isGridData()) {
GridData gdata = this.currentDataInfo.getGridData(varName);
MapLayer layer = DrawMeteoData.createContourLayer(gdata, varName, varName);
if (mapLayout == null) {
mapLayout = new MapLayout();
}
MapFrame mapFrame = mapLayout.getActiveMapFrame();
MapView mapView = mapFrame.getMapView();
mapView.setLockViewUpdate(true);
mapFrame.addLayer(layer);
mapLayout.getActiveLayoutMap().zoomToExtentLonLatEx(mapView.getMeteoLayersExtent());
mapView.setLockViewUpdate(false);
mapLayout.paintGraphics();
}
}
示例2: setMapFrames
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Set map frames
*
* @param mfs Map frames
*/
public void setMapFrames(List<MapFrame> mfs) {
_mapFrames = mfs;
_mapFrames = new ArrayList<>();
for (MapFrame mf : mfs) {
boolean isInsert = false;
for (int i = 0; i < _mapFrames.size(); i++) {
MapFrame amf = _mapFrames.get(i);
if (mf.getOrder() < amf.getOrder()) {
_mapFrames.add(i, mf);
isInsert = true;
break;
}
}
if (!isInsert) {
_mapFrames.add(mf);
}
}
}
示例3: jButton_ZoomToLayerActionPerformed
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
private void jButton_ZoomToLayerActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (_mapDocument.getSelectedNode() == null) {
return;
}
if (_mapDocument.getSelectedNode().getNodeType() == NodeTypes.LayerNode) {
MapFrame aMF = _mapDocument.getCurrentMapFrame();
MapLayer aLayer = ((LayerNode) _mapDocument.getSelectedNode()).getMapLayer();
if (aLayer != null) {
Extent oldExtent = (Extent) aMF.getMapView().getViewExtent().clone();
aMF.getMapView().zoomToExtent(aLayer.getExtent());
UndoableEdit edit = (new MapViewUndoRedo()).new ZoomEdit(aMF.getMapView(), oldExtent, (Extent) aMF.getMapView().getViewExtent().clone());
zoomUndoManager.addEdit(edit);
this.refreshZoomUndoRedo();
}
}
}
示例4: openProjectFile
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Open project file
*
* @param projFile project file path
*/
@Override
public void openProjectFile(String projFile) {
for (MapFrame mf : _mapDocument.getMapFrames()) {
if (mf.getMapView().getLayerNum() > 0) {
mf.removeAllLayers();
}
}
//Application.DoEvents();
loadProjectFile(projFile);
_mapView = _mapDocument.getActiveMapFrame().getMapView();
setMapView();
//setMapLayout();
_mapDocument.paintGraphics();
_mapView.zoomToExtent(_mapView.getViewExtent());
}
示例5: MeteoInfoScript
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Constructor
* @param path Start up path
*/
public MeteoInfoScript(String path) {
this.startUpPath = path;
this.batchMode = true;
this.mapLayout = new MapLayout();
this.chartPanel = new ChartPanel(null);
dataInfoList = new ArrayList<MeteoDataInfo>();
drawType2D = DrawType2D.Contour;
this.plotDimension = PlotDimension.Lat_Lon;
this.isMap = true;
//Add default map layer
//String fn = path + File.separator + "map" + File.separator + "country1.shp";
String fn = "D:/Temp/map/country1.shp";
if (new File(fn).exists()){
try {
MapLayer layer = MapDataManage.loadLayer(fn);
PolygonBreak pgb = (PolygonBreak)layer.getLegendScheme().getLegendBreaks().get(0);
pgb.setDrawFill(false);
MapFrame mapFrame = mapLayout.getActiveMapFrame();
MapView mapView = mapFrame.getMapView();
mapView.setLockViewUpdate(true);
mapFrame.addLayer(layer);
mapFrame.setGridXDelt(60);
mapFrame.setGridYDelt(30);
mapLayout.getActiveLayoutMap().zoomToExtentLonLatEx(mapView.getLayersWholeExtent());
mapView.setLockViewUpdate(false);
} catch (Exception ex) {
Logger.getLogger(MeteoInfoScript.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
示例6: MeteoInfoMap
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Constructor
*
* @param path Start up path
*/
public MeteoInfoMap(String path) {
this.startUpPath = path;
this.batchMode = true;
this.mapLayout = new MapLayout();
drawType2D = DrawType2D.Contour;
//Add default map layer
//String fn = path + File.separator + "map" + File.separator + "country1.shp";
String fn = "D:/Temp/map/country1.shp";
if (new File(fn).exists()) {
try {
MapLayer layer = MapDataManage.loadLayer(fn);
PolygonBreak pgb = (PolygonBreak) layer.getLegendScheme().getLegendBreaks().get(0);
pgb.setDrawFill(false);
MapFrame mapFrame = mapLayout.getActiveMapFrame();
MapView mapView = mapFrame.getMapView();
mapView.setLockViewUpdate(true);
mapFrame.addLayer(layer);
mapFrame.setGridXDelt(60);
mapFrame.setGridYDelt(30);
mapLayout.getActiveLayoutMap().zoomToExtentLonLatEx(mapView.getLayersWholeExtent());
mapView.setLockViewUpdate(false);
} catch (Exception ex) {
Logger.getLogger(MeteoInfoMap.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
示例7: display
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Dislay
*
* @param gdata GridData
*/
public void display(GridData gdata) {
MapLayer layer = DrawMeteoData.createContourLayer(gdata, "meteo_layer", "data");
if (mapLayout == null) {
mapLayout = new MapLayout();
}
MapFrame mapFrame = mapLayout.getActiveMapFrame();
MapView mapView = mapFrame.getMapView();
mapView.setLockViewUpdate(true);
mapFrame.addLayer(layer);
mapLayout.getActiveLayoutMap().zoomToExtentLonLatEx(mapView.getMeteoLayersExtent());
mapView.setLockViewUpdate(false);
mapLayout.paintGraphics();
}
示例8: MapPlot
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Constructor
*
* @param mapView MapView
*/
public MapPlot(MapView mapView) {
this();
this.setMapView(mapView, true);
this.mapFrame = new MapFrame();
this.mapFrame.setMapView(mapView);
}
示例9: getAllFonts
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Get all available fonts (system fonts, weather font and custom fonts)
*
* @return Font list
*/
public static List<Font> getAllFonts() {
List<Font> fontList = new ArrayList<>();
//Weather font
Font weatherFont = getWeatherFont();
if (weatherFont != null) {
fontList.add(weatherFont);
}
//System fonts
GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fonts = gEnv.getAllFonts();
for (Font font : fonts) {
fontList.add(font);
}
//Custom fonts
String fn = GlobalUtil.getAppPath(MapFrame.class);
fn = fn.substring(0, fn.lastIndexOf("/"));
String path = fn + File.separator + "font";
File pathDir = new File(path);
if (pathDir.isDirectory()) {
}
return fontList;
}
示例10: LayoutMap
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Constructor
*
* @param mapFrame MapFrame
* @param tll TileLoadListener
*/
public LayoutMap(MapFrame mapFrame, TileLoadListener tll) {
super();
this.setElementType(ElementType.LayoutMap);
this.setResizeAbility(ResizeAbility.ResizeAll);
this.setMapFrame(mapFrame);
this.tileLoadListener = tll;
}
示例11: getActiveMapFrame
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Get active map frame
*
* @return Active map frame
*/
public MapFrame getActiveMapFrame() {
for (MapFrame mf : _mapFrames) {
if (mf.isActive()) {
return mf;
}
}
return null;
}
示例12: setActiveMapFrame
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
/**
* Set a map frame as active
*
* @param mapFrame The map frame
*/
public void setActiveMapFrame(MapFrame mapFrame) {
for (MapFrame mf : _mapFrames) {
mf.setActive(false);
}
mapFrame.setActive(true);
this.fireActiveMapFrameChangedEvent();
}
示例13: getLayoutMap
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
private LayoutMap getLayoutMap(MapFrame mapFrame) {
LayoutMap aLM = null;
for (LayoutMap lm : this.getLayoutMaps()) {
if (lm.getMapFrame() == mapFrame) {
aLM = lm;
break;
}
}
return aLM;
}
示例14: jButton_ZoomToLayerActionPerformed
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
private void jButton_ZoomToLayerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ZoomToLayerActionPerformed
// TODO add your handling code here:
if (this.layersLegend1.getSelectedNode() == null) {
return;
}
if (this.layersLegend1.getSelectedNode().getNodeType() == NodeTypes.LayerNode) {
MapFrame aMF = this.layersLegend1.getCurrentMapFrame();
MapLayer aLayer = ((LayerNode) this.layersLegend1.getSelectedNode()).getMapLayer();
if (aLayer != null) {
aMF.getMapView().zoomToExtent(aLayer.getExtent());
}
}
}
示例15: layout_MouseMoved
import org.meteoinfo.legend.MapFrame; //导入依赖的package包/类
private void layout_MouseMoved(MouseEvent e) {
Point pageP = _mapDocument.getMapLayout().screenToPage(e.getX(), e.getY());
for (MapFrame mf : _mapDocument.getMapFrames()) {
Rectangle rect = mf.getLayoutBounds();
if (MIMath.pointInRectangle(pageP, rect)) {
double pXY[] = mf.getMapView().screenToProj((double) (pageP.x - rect.x), (double) (pageP.y - rect.y), _mapDocument.getMapLayout().getZoom());
double projX = pXY[0];
double projY = pXY[1];
if (mf.getMapView().getProjection().isLonLatMap()) {
this.jLabel_Coordinate.setText("Lon: " + String.format("%1$.2f", projX) + "; Lat: " + String.format("%1$.2f", projY));
} else {
this.jLabel_Coordinate.setText("X: " + String.format("%1$.1f", projX) + "; Y: " + String.format("%1$.1f", projY));
String theText = this.jLabel_Coordinate.getText();
if (mf.getMapView().getProjection().getProjInfo().getProjectionName() == ProjectionNames.Robinson) {
return;
}
ProjectionInfo toProj = KnownCoordinateSystems.geographic.world.WGS1984;
ProjectionInfo fromProj = mf.getMapView().getProjection().getProjInfo();
double[][] points = new double[1][];
points[0] = new double[]{projX, projY};
try {
Reproject.reprojectPoints(points, fromProj, toProj, 0, 1);
this.jLabel_Coordinate.setText(theText + " (Lon: " + String.format("%1$.2f", points[0][0]) + "; Lat: "
+ String.format("%1$.2f", points[0][1]) + ")");
} catch (Exception ex) {
//this.TSSL_Coord.Text = "X: " + ProjX.ToString("0.0") + "; Y: " + ProjY.ToString("0.0");
}
}
break;
}
}
}