Hi,
I would reproduce the image reported below.
I’m using an image like this
My questions are:
- How can I change background color of picture?
- How can I rotate shape?
This is my code only with two azimuth 50° and 150°:
Dim sf As New Shapefile()
sf.CreateNewWithShapeID("", ShpfileType.SHP_POINT)
sf.CollisionMode = tkCollisionMode.AllowCollisions
Dim img As New Image
img.Open("C:\temp\triangle2.png", ImageType.PNG_FILE, False, Nothing)
Dim utils As New Utils
Dim ct = sf.Categories.Add("site")
Dim opt = ct.DrawingOptions
opt.PointType = tkPointSymbolType.ptSymbolPicture
opt.FillType = tkFillType.ftPicture
opt.FillColor = utils.ColorByName(tkMapColor.Yellow)
opt.Picture = img
Dim pnt As New Point()
pnt.x = x 'longitude
pnt.y = y 'latitude
Dim shp As Shape = New Shape
shp.Create(ShpfileType.SHP_POINT)
shp.AddPoint(x, y)
shp.Rotate(x, y, 50)
Dim shp1 As Shape = New Shape
shp1.Create(ShpfileType.SHP_POINT)
shp1.Rotate(x, y, 150)
shp1.AddPoint(x, y)
sf.EditAddShape(shp)
sf.EditAddShape(shp1)
sf.StopEditingShapes()
My issues:
First point:
Background color doesn’t affect with code
opt.FillColor = utils.ColorByName(tkMapColor.Yellow)
Second Point:
Rotation of shape doesn’t affect.
Maybe a solution is to create several categories each one for a single azimuth (from 0° to 359°) like this:
Dim ct = sf.Categories.Add("site")
Dim opt = ct.DrawingOptions
opt.PointType = tkPointSymbolType.ptSymbolPicture
opt.FillType = tkFillType.ftHatch
opt.FillColor = utils.ColorByName(tkMapColor.Yellow)
opt.Picture = img
opt.PointRotation = 50
ct = sf.Categories.Add("site1")
opt = ct.DrawingOptions
opt.PointType = tkPointSymbolType.ptSymbolPicture
opt.FillType = tkFillType.ftHatch
opt.FillColor = utils.ColorByName(tkMapColor.Yellow)
opt.Picture = img
opt.PointRotation = 150
and afterwards I assign each categories to relative shape (i.e. TrackCars.cs)
but I don’t know if is the best solution
How can I proceed?
Thank in advanced
gio