In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "how to understand Java MeteoInfo parsing and drawing code tutorial", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "how to understand Java MeteoInfo parsing and drawing code tutorial"!
Recently too busy, finally have time to continue to write, mentioned above the basic drawing method, but the lack of color level presentation, general map superimposed on the map, the back end does not need to control the color level, but also pay attention to the web page color level and our generated color level must be correct
For the back end to export the picture, you need to add color levels, this article is very simple, involving color levels, names, grid tick marks
By the way, I optimized the code to make it look more direct.
MeteoDataInfo meteoDataInfo = new MeteoDataInfo (); meteoDataInfo.openMICAPSData ("D:\\ parse data\\ cldas\ cldas\\ TEM\ 20081000.000"); GridData grid = meteoDataInfo.getGridData () / / read the map A VectorLayer scmap = MapDataManage.readMapFile_ShapeFile ("C:\\ Users\\ Administrator\\ Downloads\\ good example Subnet _ shp format vector map of the national provincial and county boundaries (accurate to the county area)\\ national provincial and county boundaries shp format vector map (accurate to the county area)\\ sichuan.shp") / / read the map B VectorLayer qgmap = MapDataManage.readMapFile_ShapeFile ("E:\\ shp\\ Sichuan\\ Sichuan (3) _ city boundary .shp"); / / describe the map boundary PolygonBreak pb = (PolygonBreak) qgmap.getLegendScheme (). GetLegendBreak (0); / / whether to set fill pb.setDrawFill (false); / / set outline color pb.setOutlineColor (Color.black) / / read levels LegendScheme als = LgsUtil.readFromLgs ("D:\\ apache-tomcat-8.0.50\\ alt levels\\ TEM.lgs"); / / draw layers VectorLayer layer = DrawMeteoData.createShadedLayer (grid,als, ",", true); / / create views MapView view = new MapView (); layer = layer.clip (scmap) / / overlay layer view.addLayer (layer); view.addLayer (qgmap); / / View setting MapLayout layout = new MapLayout (); / / remove graphics frame layout.getActiveMapFrame () .setDrawNeatLine (true); / / Anti-aliasing layout.getActiveMapFrame () .setMapView (view); view.setAntiAlias (true); layout.setAntiAlias (true) / / calculate the width and height of the view according to the view Extent extent = view.getExtent (); int size = 800; Rectangle rectangle = new Rectangle (size, (int) (size * 1D / extent.getWidth () * extent.getHeight (); / / set the map area size and outer margin int width = rectangle.width; int left = 50; int height = rectangle.height Int right = 140; int top = 50; int bottom = 50; / set page boundary layout.setPageBounds (new Rectangle (0,0, width + left + right, height + top + bottom)); / / get map box MapFrame frame = layout.getActiveMapFrame (); / / set layout boundary frame.setLayoutBounds (new Rectangle (left, top, width, height)) / / draw grid tick lines frame.setDrawGridLine (true); / / set grid interval values frame.setGridXDelt (0.5); frame.setGridYDelt (0.5); / / set legend Rectangle bounds = layout.getActiveMapFrame (). GetLayoutBounds (); LayoutLegend legend = layout.addLegend (bounds.x + bounds.width + 15,0); legend.setLegendStyle (LegendStyles.Normal) Legend.setTop (bounds.y + (bounds.height-legend.getHeight ()) / 2); legend.setLegendLayer (layer); / / Export layout.exportToPicture (PathUtil.getDeskPath () + "/ 1.png")
The above methods I only set the scale and color levels, the other is also very simple, I will explain below
Title setting-put behind the set view size Rectangle bounds = layout.getActiveMapFrame (). GetLayoutBounds (); layout.addText (title, bounds.x + bounds.width / 2, y, 18)
Up to now, there is nothing to say about simple drawing and setting. The basic operations are all in the article. They are all styled things. These are all pictures that have been interpolated. But in the course of development, we will also encounter the site data returned directly by Sky Rock and CIMISS. How to draw the next section will be explained, and the later chapters will be the study of individual issues.
Thank you for your reading, the above is the content of "how to understand Java MeteoInfo parsing and drawing code tutorial". After the study of this article, I believe you have a deeper understanding of how to understand the Java MeteoInfo parsing and drawing code tutorial, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.