Vector graphics in Xbase++

This forum is for eXpress++ general support.
Post Reply
Message
Author
Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Vector graphics in Xbase++

#1 Post by Victorio »

Hi,
Some time I experimenting with vector graphics in Xbase. I have some digital maps (cadastral maps) where all parcels are as vector closed objects with coordinates x and y.
So I have viewer which can show this map to screen with GraLine/Grapos etc. functions. This works good, but I need interact with this map.
Now I can identify coordinates on screen and know calculate this to other cadastral coordinates. But I do not know how realize identify vector blocks (vector polygons) on screen.
This block can be very complicated polygons with hidden lines etc.

When I click to surface in this block I need identify it and do something for example change color or show data from database.

I tryed to set some section as rectangle with coordinates x1,yx to x2,y2 and when mouse is on this can identify that it is just concrete parcel.
But this need cut full map to many small rectangles.

Better way will be to can click to line of block and read for what parcel is this line. But not know some system how identify line when click with cursor to it.

I know this is not job for Alaska Xbase++ language, but I mean exist some way to create handy application for simply use.

For example demo Pendraw can paint lines, rectangles, circles, but I do not know how can do more with created objects .

If somebody have some tip, or some library for vector graphics, this can help me.

I know do something with SHP but at this moment need vector graphics because converting vector to SHP is qiute complicated.
:roll:
Attachments
Here is example of drawing maps with identify coordinates where is mouse
Here is example of drawing maps with identify coordinates where is mouse
mapka.gif (64.32 KiB) Viewed 11851 times

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Vector graphics in Xbase++

#2 Post by rdonnay »

Have you thought about XbpMetaFile?
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Vector graphics in Xbase++

#3 Post by Eugene Lutsenko »

That's cool! I worked with graphics up to 4K but raster. It is still displayed in the raster. If I understand your task correctly, You want the image itself to respond to mouse clicks. I think it can be done this way. Make a digital model of the image. Determine the coordinates of the mouse click (it seems not very difficult, I did). Then analytically and programmatically determine which element of the image clicked the mouse. Then redraw only this element with a different color and background. The redrawing itself should not take much time. If the mouse is removed from the element again redraw the element as it was before. After you define an item, you can select all the information about it from the database and display it in a separate window or in the area of the image itself intended for this purpose. And usually this area is erased.

Это круто! Я работал с графикой до 4K, но растровой. Все равно на экран выводится в растре. Если я правильно понял вашу задачу, то Вы хотите, чтобы само изображение реагировало на клики мышкой. Мне кажется это можно сделать так. Сделать цифровую модель изображения. Определять координаты клика мышки (это вроде не очень сложно, я делал). Потом аналитически и программно определять на каком элементе изображения кликнули мышкой. Потом перерисовывать только этот элемент другим цветом и с фоном. Сама перерисовка не должна занять много времени. Если мышку убрали с элемента опять перерисовывать элемент таким, каким он был раньше. Определив элемент, можно выбирать из базы данных все сведения о нем и отображать в отдельном окошке или в зоне самого изображения, предназначенной для этой цели. А обычно эта зона стирается.

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Vector graphics in Xbase++

#4 Post by Victorio »

Roger, XbpMetaFile is important, but if I understand good, can contain only bitmap and raster. So when I throw vector system this can use similarly as shp (shapes)
I wii think about it.

Eugene, paint large vector map on my PC (i7 -7700 3.6GHz) with 250000 points (intersections) need only 4 seconds. Also redraw (when zoom, pan ) full map need same time.
Redraw only one object also is not problem.
As you suggest, can be work.
Problem is with define when I click into plygon.

Only for test I tryed this :

Code: Select all

 
        if (poziciax>145 .and. poziciax<311 .and. poziciay>541 .and. poziciay<658)
                MSGBOX("You click to right polygon...")
        endif
but here is define only approximate rectangle where is "right" parcel/polygon.

in attached file is how look real parcels from commercial software for view cadastral maps.

In rectangle2 is example where if user click to line, in dialog window can select which line want, because all lines are duplicated. This system I can use when create mechanizm to define database all lines and calculate if mouse is on point between two points which define vector line. Or calculate some intersection with some approximate range because user can click for example 3 points out from line. I am worried that this calculation can be slow, however I will try it.

Other system how I saw on other version commercial application is when user click to "surface" polygon, to optional point inside polygon. This is more comfortable, but here I do not know how calculate when I am inside polygon.

Here is how are points map in map file :
&O KLADPAR 11
&A PARCIS=398.004
&L P 200648.74 1255441.77 B=620192 C=1 K=1
L 200645.56 1255434.01 C=2
L 200631.62 1255439.64 B=620235 C=5 T=1
L 200634.12 1255445.77 B=620192 C=4
L 200632.02 1255446.60 C=5
L 200634.27 1255452.09 C=6
L 200641.85 1255449.04 B=620235 C=3 T=1
L 200640.21 1255445.21 B=620192 C=8
L 200648.74 1255441.77 C=1
&T 200639.52 1255439.55 '398/4' D=5 F=1 H=1.6 K=1


L P is start point of polygon
L is line (can be also NL when line is not visible
last L is end of polygon and his coordinates are same as first point

T is text in polygon, (cadastral parcel number) at this time I have not in my viewer.

I realize zoom, and pan with zoopfactor, where all coordinates are recalculating to show on screen area.
Attachments
rectangle2.gif
rectangle2.gif (25.96 KiB) Viewed 11834 times
rectangle.gif
rectangle.gif (54.92 KiB) Viewed 11834 times

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Vector graphics in Xbase++

#5 Post by Auge_Ohr »

do you have GPS Coordinate ?
what about Google-View ?

i think PostgreSQL and GIS (Geographic Information System) is what you looking for.
https://postgis.net/
greetings by OHR
Jimmy

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Vector graphics in Xbase++

#6 Post by Victorio »

Jimmy: coordinates in my map are JTSK this is local country system, but I can convert it to WGS84 this is same as GPS however conversion is not accurate because there are some diferencies how map reflect roundless earth. But for my use when identify object this can be enough.

PostgeGIS , I will look for this can be interesting but more more study time to learn how use it. THX.

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Vector graphics in Xbase++

#7 Post by rdonnay »

XbpMetaFile is important, but if I understand good, can contain only bitmap and raster
I have never used it but when I looked at an Xbase++ sample program (about 20 years ago), it looked like it was storing and drawing vectors.

Possibly, you could create your own vector database, assuming that every object is a straight-line vector.
When you draw a vector, you can save the beginning and end coordinates in a database.
Then, when you click on the screen to pick a screen coordinate you would have an algorithm that finds the object in the database.
I imagine this as being a slow process, but it could work.
Doesn't sound like a job for Xbase++ though.

I have a 3D printer and it uses STL (stereo lithography) files.
An STL file is a bunch of connected triangles that can render in 3 dimensions.
The eXpress train is coming - and it has more cars.

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Vector graphics in Xbase++

#8 Post by Victorio »

Roger, I have vector map in database, every polygon in database is block of several rows with x,y coordinates, that this is not problem .
For better speed drawing database is first load to array and then paint to screen, and this works quite well

I found some source for find if point is inside polygon in Foxpro , this I want rewrite to Xbase++ and I mean this will work for me.
Attachments
source.zip
(1.68 KiB) Downloaded 650 times

Post Reply