|
Use of cartography in the applications, by means of NGIS component If you create the project in programming
environment Delphi and it is necessary for you mapping the visual information.
For example, we shall take the electric system automation of the city,
for a computer user, it is better to give the information in more informative
form in the form of map, where it is possible to see visually location
of objects at once. There are many various programs of such large companies
as MapInfo, ArcGis, ESRI. For embedding maps in applications they have
such products as MapX, MapObject and they are fulfilled in the form of
ActiveX components.Using them in Delphi environment arises some inconveniences
and they do not give flexibility by operation. And then it has been decided
to create the components which would give greater flexibility. Components
which will be installed in development environment and give following
main possibilities: to trace any additional objects or animation on a
map, to have direct access to data of geoobjects. Support of the most
widespread format of geodata MapInfo, drawing of all main using objects.
Possibility of drawing of all using hatchings of areas and styles lines,
navigation functions of zoom in/zoom out, selection of objects on a map.
ÒAs widely known class TCanvas which gives any possibility
for mapping the additional information has been used. Also loading possibility
of several maps in the form of layers has been realized. This possibility
is realized and it is inherited from convenient class TCollection. Short descriptions use of components: 1. Create the new project and open the new form. 2. Select TNMap component from a bookmark and expand it on the form. 3. Double click on a component will quit the empty list of layers, add a new
layer in a component pressing the button. The component supports showing
several maps (layers). In the given editor it is possible to add and delete
layers, and also to change their sequence. The order of following layers
which showing goes according to the given order is also important. 4. Select the layer necessary to you and come in Object Inspector, in property
«FileName» specify a filename. For showing a layer install property «ShowMap»
in «True». 5. There are three ways to specify location of data for a cartographical
layer. The very first way has been mentioned above. The second way, for
convenience of carring the application on other computer, it is possible
to specify path to geographical data through the register of system, for
this purpose fill path of property «NRegistryRoot», «NRegistryPath», «NRegistryName».
Filling the given properties, in property «FileName» it is possible to
use key words %REG%, opening a layer the keyword, will be replaced by
value from the register. 6. The third way to save the geographical data given in resources in file DFM,
the given way at compiling the application geographical data will be in
an executable file, and the application will be more independent. It is
possible to create the application which will consist only of one executable
file. For this purpose in a layer specify path to data through property
«FileName», install property «ShowMap» in true and further install property
«SaveToDFM» in true, data of a layer will be saved as a resource in DFM.
Now you can remove a property setting «FileName» as it is not used any
more by a layer. 7. Also it is possible to install initial position of map loading. For this
purpose there is a convenient editor of initial position setting of a
map, press the right button on a component and from the dropping out menu
select the item « Set position... ». By means of the given editor it is
possible to increase, reduce and move a map. After a choice of the scale
necessary to you press the button « Set position » in the editor and initial
parameters of scale of a map in following properties «NStartWidth», «NStartX»,
«NStartY» will be installed. 8. With each geographical object on a map there is a linked record in
tabled data. For each layer on a map it is possible to set output of the
text information (labels) (For example: the name of cities, streets, etc.).
For drawing labels come on the necessary layer and set the field which
you wish to output « LabelParams-> FieldName », in addition you can
set a font of labels. After all settings install property «DrawLabels»
in true and labels will be displayed on a map. 9. For each layer of a map it is possible to set scale of visibility that will
allow to make maps more informative. For example, if you to take a map
of city at start loading, large areas of city, the main streets and avenues
will be shown on a map, in process of increase in scale more detailed
layers small streets, lanes and houses will also be shown. For scale setting
show install in properties «NMinWidth», « « NMaxWidth » » a range of show
layer. |