CN111724454B - Oversized drawing part imaging method and system based on GDI+ and GDAL - Google Patents

Oversized drawing part imaging method and system based on GDI+ and GDAL Download PDF

Info

Publication number
CN111724454B
CN111724454B CN202010375768.2A CN202010375768A CN111724454B CN 111724454 B CN111724454 B CN 111724454B CN 202010375768 A CN202010375768 A CN 202010375768A CN 111724454 B CN111724454 B CN 111724454B
Authority
CN
China
Prior art keywords
gdal
graphic
gdi
document
transparency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010375768.2A
Other languages
Chinese (zh)
Other versions
CN111724454A (en
Inventor
李仙伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Zhentu Network Technology Co ltd
Original Assignee
Wuhan Zhentu Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Zhentu Network Technology Co ltd filed Critical Wuhan Zhentu Network Technology Co ltd
Priority to CN202010375768.2A priority Critical patent/CN111724454B/en
Publication of CN111724454A publication Critical patent/CN111724454A/en
Application granted granted Critical
Publication of CN111724454B publication Critical patent/CN111724454B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The invention discloses a method and a system for drawing an oversized drawing based on GDI+ and GDAL, which realize drawing and outputting of the oversized drawing by combining GDI+ and GDAL, wherein the method comprises the following steps: s1: creating a oversized drawing document through GDAL; s2: calculating the number N of dividing strips of the drawing according to the size of the drawing and the memory of the computer, dividing the drawing into N strips of R1, R2 and R3 … Ri … RN, and sequentially executing the steps S3, S4, S5 and S6 respectively; s3: creating a Bitmap object of the Ri strip through GDI+, and creating a Graphics object; s4: calculating and changing the origin of the coordinate system according to the strip sequence number i; s5: drawing graphic contents through Graphics objects; s6: the Bitmap object is written to the drawing document via GDAL. By the method, the ultra-large drawing and outputting can be realized on common computer equipment, and the system is based on the Net Framework and the open source graphic library, does not depend on a third party interface, and can be used in various environments of a client and a server.

Description

Oversized drawing part imaging method and system based on GDI+ and GDAL
Technical Field
The invention relates to the fields of computer graphics, geographic information systems, remote sensing image processing and the like, in particular to a method and a system for drawing and outputting oversized drawing.
Background
GDI+ (Graphics Device Interface plus) is an optimized and expanded graphic device interface based on GDI, can meet the requirements of developers on graphic output, has rich interfaces, and provides a bottom layer method almost required by drawing. However, the gdi+ has the biggest problem, namely, the problem of memory overflow, and the sizes of the images which can be read and written under different x86 and x64 architectures and different memory conditions are different, so that the drawing and output of the GB-level oversized drawing cannot be satisfied.
GDAL (Geospatial Data Abstraction Library) is an open source geospatial data abstract library under the X/MIT permission protocol, and GDAL supports the reading and writing of image data in various formats, and is particularly widely applied in the field of remote sensing image processing. However, the GDAL only provides the operations of reading and writing image data, which are based on byte arrays, and currently does not provide a graphics rendering interface similar to gdi+, which cannot meet the drawing requirements of the drawing.
Disclosure of Invention
The invention mainly solves the technical problem of providing a method and a system for drawing oversized drawing based on GDI+ and GDAL, and can provide a quick, efficient and GB-level drawing and outputting method for developers.
In order to solve the technical problems, the invention adopts a technical scheme that: a method and system for oversized drawing based on GDI+ and GDAL is provided. Comprising the following steps.
S1: oversized drawing documents are created by GDAL.
S2: according to the size of the drawing and the memory of the computer, calculating the number N of the dividing strips of the drawing, dividing the drawing into R 1 、R 2 、R 3 …R i …R N N stripes are added, and the steps S3, S4, S5 and S6 are respectively executed in sequence.
S3: creation of R by GDI + i The Bitmap object of the strip and creates Graphics object.
S4: and calculating and changing the origin of the coordinate system according to the strip sequence number i.
S5: drawing graphic contents through Graphics objects.
S6: the Bitmap object is written to the drawing document via GDAL.
The beneficial effects of the invention are as follows: the invention discloses a method and a system for drawing oversized drawing based on GDI+ and GDAL, which can provide a quick, efficient and GB-level drawing and outputting method for developers by combining GDI+ and GDAL, is based on a Net Framework and an open source graphic library, does not depend on a third party interface, and can be used in various environments of a client and a server.
Drawings
Fig. 1 is a schematic diagram.
Fig. 2 is an overall flowchart.
Fig. 3 is a sub-flowchart of S3.
Fig. 4 is a sub-flowchart of S5.
Detailed Description
The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making clear and defining the scope of the present invention.
As shown in fig. 1, 2, 3 and 4, an embodiment of the present invention provides a gdi+ and GDAL-based oversized drawing method, which includes the following steps.
S1: oversized drawing documents are created by GDAL. In order to read and write oversized drawing documents conveniently, a BigImageWriter object is packaged, two constructors are provided, blank drawing documents can be newly built, or existing drawing documents can be opened, the existing drawing documents are read through readBytes and readImage by means of packaging ReadBytes, writeBytes, readImage, writeImage, dispose and the like, drawn Bitmap results are written through the WriteBytes and the WriteImage, and resources are released through Dispose.
S2: according to the size of the drawing and the memory of the computer, calculating the number N of the dividing strips of the drawing, dividing the drawing into R 1 、R 2 、R 3 …R i …R N N stripes are added, and the steps S3, S4, S5 and S6 are respectively executed in sequence.
S3: creation of R by GDI + i The Bitmap object of the strip and creates Graphics object. The Bitmap object of the Ri band needs to output the creating mode of the drawing document according to step S1, that is, create a blank Bitmap object, or read from the existing graphic document to obtain the Bitmap object. Blank Bitmap objects can be created directly by gdi+. The bitimagewriter.readimage may be invoked to read a Bitmap object from an existing graphic document, including the following sub-steps.
S31: according to the rectangular range of the current drawn strip, reading byte arrays of 1, 2, 3 and 4 wave bands from the existing graphic document through GDAL, wherein the byte arrays respectively correspond to 4 channels of a (transparency), r (red), g (green) and b (blue), and if no transparency channel exists, the wave bands of 1, 2 and 3 respectively correspond to r (red), g (green) and b (blue).
S32: creating a Bitmap object according to the rectangular range of the current drawn stripe, and then writing the byte array read in the S31 into the Bitmap object through Bitmap, lockBits and Marshal.
S4: and calculating and changing the origin of the coordinate system according to the strip sequence number i. Defining width as the width of the drawing, wherein the origin xoff=0 and yoff=i of the coordinate system are the width; the origin of the coordinate system is reset and set by two methods of graphics.
S5: drawing graphical content through Graphics objects includes the following sub-steps.
S51: based on GDI+ packaging of graphic objects such as straight lines, broken lines, polygons, rectangles, circles, pictures, characters and the like, the method specifically comprises ShapeObject, backColorShape, straightLineShape, polylineShape, polygonShape, rectangleShape, circleShape, imageShape, stringTextShape and the like, and coordinates of the graphics, parameters such as a Brush Pen, a Brush, a Font, an alignment mode StringFormat and the like are defined in the objects, wherein the shape object is a base class of other classes.
S52: according to the size of the image and the graphic content, the world coordinates are converted into image coordinates, and the graphic objects are sequentially added to the collection shape list according to the graphic objects defined in the step S51.
S53: and (5) cycling the Shape list set, and combining DrawLine, drawLines, drawRectangle, drawRectangles, drawPolygon, fillPolygon, fillRectangle, fillRectangles, drawString, drawImage and other basic methods for calling Graphics according to the Shape type to draw the Graphics.
S6: the Bitmap object is written to the drawing document via GDAL. The specific method comprises the following steps: converting the Bitmap object into a byte array through Bitmap, lockBits and Marshal.copy to obtain an RGBytesObject object, and then writing data in the RGBytesObject object into a map document through GDAL.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent structures or equivalent processes or direct or indirect application in other related technical fields are included in the scope of the present invention.

Claims (5)

1. The GDI+ and GDAL-based oversized drawing method and system are characterized in that the GDI+ and GDAL-based oversized drawing method comprises the following steps:
s1: creating a oversized drawing document through GDAL;
s2: calculating the number N of dividing strips of the drawing according to the size of the drawing and the memory of the computer, dividing the drawing into N strips of R1, R2 and R3 … Ri … RN, and sequentially executing the steps S3, S4, S5 and S6 respectively;
s3: creating a Bitmap object of the Ri strip through GDI+, and creating a Graphics object;
s4: calculating and changing the origin of the coordinate system according to the strip sequence number i;
s5: drawing graphic contents through Graphics objects;
s6: writing the Bitmap object into the map document through GDAL;
in step S3, the Bitmap object of the Ri band needs to output the creating manner of the drawing document according to step S1, that is, create a blank Bitmap object, or read from the existing graphic document to obtain the Bitmap object, which includes the following steps:
s31: according to the rectangular range, reading byte arrays of 4 channels of transparency, red, green and blue through GDAL, wherein the transparency channels can be empty;
s32: converting the byte array into a Bitmap object through bitmap.lockbits and Marshall.copy;
in step S6, converting the Bitmap object into a byte array through the Bitmap, lockbits and Marshall, obtaining an RGBytesObject object, and then writing the data in the RGBytesObject object into the map document through the GDAL.
2. The method according to claim 1, wherein in step S1, the drawing document supports three graphic formats of tif, img and png, and a blank graphic document can be newly created or created from an existing graphic document, and the drawing document supports a size of 2GB or more.
3. The method according to claim 1, wherein said step S5 comprises the sub-steps of:
s51: based on GDI+ packaging of graphic objects such as straight lines, broken lines, polygons, rectangles, circles, pictures, characters and the like, the graphic objects comprise ShapeObject, backColorShape, straightLineShape, polylineShape, polygonShape, rectangleShape, circleShape, imageShape, stringTextShape and the like, and parameters such as coordinates, colors, widths, alignment modes and the like of the graphics are defined in the objects, wherein the shape object is a base class of other classes;
s52: converting world coordinates into image coordinates according to the size of the formed image and the graphic content, and sequentially adding the graphic objects to a set shape list according to the graphic objects defined in the step S51;
s53: and (5) cycling the Shape list set, and combining DrawLine, drawLines, drawRectangle, drawRectangles, drawPolygon, fillPolygon, fillRectangle, fillRectangles, drawString, drawImage and other basic methods for calling Graphics according to the Shape type to draw the Graphics.
4. The method of claim 1, wherein the RGBBytesObject object includes 5 attributes of ABand, RBand, GBand, BBand, opacity, wherein ABand, RBand, GBand, BBand is a byte array of 4 band channels of transparency, red, green, and blue, and wherein Opacity is superimposed transparency.
5. The method of claim 4, wherein the transparency of the transparency is the transparency of the overall overlay of the currently drawn graphic on an ABand basis, and the transparency is calculated by blending with the ABand channel during the drawing, mainly to achieve the semitransparent overlay effect between the graphic objects.
CN202010375768.2A 2020-05-07 2020-05-07 Oversized drawing part imaging method and system based on GDI+ and GDAL Active CN111724454B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010375768.2A CN111724454B (en) 2020-05-07 2020-05-07 Oversized drawing part imaging method and system based on GDI+ and GDAL

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010375768.2A CN111724454B (en) 2020-05-07 2020-05-07 Oversized drawing part imaging method and system based on GDI+ and GDAL

Publications (2)

Publication Number Publication Date
CN111724454A CN111724454A (en) 2020-09-29
CN111724454B true CN111724454B (en) 2023-09-19

Family

ID=72564214

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010375768.2A Active CN111724454B (en) 2020-05-07 2020-05-07 Oversized drawing part imaging method and system based on GDI+ and GDAL

Country Status (1)

Country Link
CN (1) CN111724454B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004070848A (en) * 2002-08-09 2004-03-04 Fuji Xerox Co Ltd Image processor and image processing method
CN102651138A (en) * 2012-04-10 2012-08-29 西安理工大学 JPEG picture mosaicing-based oversize picture synthesis method
CN105893620A (en) * 2016-04-28 2016-08-24 江苏物联网研究发展中心 Massive super-large image accessing method based on distributed database
CN106204734A (en) * 2015-04-30 2016-12-07 浙江宇视科技有限公司 The map integrated based on multi-source map generates method and device
US10282821B1 (en) * 2015-08-27 2019-05-07 Descartes Labs, Inc. Observational data processing and analysis

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7417645B2 (en) * 2003-03-27 2008-08-26 Microsoft Corporation Markup language and object model for vector graphics
US8176096B2 (en) * 2008-12-18 2012-05-08 Microsoft Corporation Data visualization interactivity architecture
WO2015112263A2 (en) * 2013-12-04 2015-07-30 Urthecast Corp. Systems and methods for processing distributing earth observation images

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004070848A (en) * 2002-08-09 2004-03-04 Fuji Xerox Co Ltd Image processor and image processing method
CN102651138A (en) * 2012-04-10 2012-08-29 西安理工大学 JPEG picture mosaicing-based oversize picture synthesis method
CN106204734A (en) * 2015-04-30 2016-12-07 浙江宇视科技有限公司 The map integrated based on multi-source map generates method and device
US10282821B1 (en) * 2015-08-27 2019-05-07 Descartes Labs, Inc. Observational data processing and analysis
CN105893620A (en) * 2016-04-28 2016-08-24 江苏物联网研究发展中心 Massive super-large image accessing method based on distributed database

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
.NET平台下二维地图控件的设计与实现;卫启云;张学全;王伟;;测绘通报(第09期);117-118,131 *
基于GDAL的遥感影像数据快速读取与显示方法的研究;查东平;林辉;孙华;刘年元;申展;;中南林业科技大学学报(第01期);64-68 *

Also Published As

Publication number Publication date
CN111724454A (en) 2020-09-29

Similar Documents

Publication Publication Date Title
AU2005202722B2 (en) Common charting using shapes
JP4796500B2 (en) Markup language and object model for vector graphics
US8024648B2 (en) Planar mapping of graphical elements
US7495675B1 (en) Processing illustration artwork
US6515675B1 (en) Processing opaque pieces of illustration artwork
RU2321892C2 (en) Markup language and object model for vector graphics
US8509535B2 (en) Method for emphasizing differences in graphical appearance between an original document and a modified document with annotations including outer and inner boundaries
US7692652B2 (en) Selectively transforming overlapping illustration artwork
EP1104918B1 (en) Processing illustration artwork
Finne et al. Pictures: A simple structured graphics model
CN111724454B (en) Oversized drawing part imaging method and system based on GDI+ and GDAL
US20060077210A1 (en) Rasterizing stacked graphics objects from top to bottom
US20220366621A1 (en) Systems for Generating Anti-Aliased Vector Objects
Flanagan Canvas Pocket Reference: Scripted Graphics for HTML5
JP4911585B2 (en) Image processing apparatus, image processing method, program, and information recording medium
CN108897537A (en) Document display method, computer-readable medium and a kind of computer
US20170147537A1 (en) Method, apparatus and system for reproducing a document defined in a page description language
Rost Using OpenGL for imaging
Calder Building user interfaces with lightweight objects
US20200167057A1 (en) Automatically Generated Cursor Bitmap Files from Scalable Vector Graphic (SVG) Files
CN117743483A (en) Generation method and application of polymers Cartogram chart in electronic map
CN112698889A (en) Processing method and system capable of quickly rendering vector data and electronic equipment
CN117519697A (en) Vector data visualization method and device
CN116956382A (en) Method and device for rendering and interacting DWG drawing on WEB end
Cahn et al. A response to the 1977 GSPC Core Graphics System

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant