Is there a way to change a point's style from the MapBasic window? I
want to select a number of points and change their color, however, I
don't want to use the Symbol Style button.
In other words, clicking on the symbol style button and changing a
symbol style yields nothing in the MapBasic window. What command can I
issue in the window that would do the same thing as clicking on the
button?
Thanks,
Tim Fast
Hi Tim,
As long as you only are updating points this should do the trick:
Set Style Symbol MakeSymbol(34,12,0)
Set CoordSys Table Selection
Update Selection Set OBJ = Centroid(OBJ)
Here I have chosen a black dot as symbol. You just have to specify your own.
The trick here is that I update each record with the centroid of the object.
And the centroid of a point is actually the point it self.
So I recreate the points, but I use a different symbol style than the original point.
This is also why you can't do this with other object types. They are more that just a centroid.
Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
Tel +45 6311 4900
Direct +45 6311 4908
Mob +45 5156 1045
Fax +45 6311 4949
E-mail p...@cowi.dk
http://www.cowi.dk/gis
Hi Peter,I am trying to update the style of lines selected.I know you say "This is also why you can't do this with other object types. They are more that just a centroid."I'm using (without success):set style pen makepen (7,2,0)
Update Selection Set obj = centroid(OBJ)
Cheers
Andy
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Andy,
Why not just use the line style button in MapInfo’s toolbar? Or have I missed something?
Regards,
Tom Bacon
GIS Engineer, Mouchel
T 01444 472380 │ E thomas...@mouchel.com │ W www.mouchel.com
Our values: innovation │ excellence │ integrity │ responsibility
Mouchel Limited (Mouchel) is registered in England and Wales with registered number 01686040 at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX. The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. No contracts may be concluded on behalf of Mouchel by means of email communications. Mouchel reserves the right to monitor and intercept emails sent and received on our network. |
Tom,
I am doing this manually at the moment but I’m doing this on multiple selections of lines.
I'm also changing the styles of multiple region styles (polygons) manually so if I can find a way to use mapbasic to select and change mulpile line styles and region styles this would save me a lot of effort.
Cheers
Andy
So you want MapBasic to do the selections as well? Do you have a predetermined set of queries for your required selections? It would be fairly easy to write an MBX to carry out a number of queries and change object styles based on these queries at the push of a button.
Error! Filename not specified.
Mouchel Limited (Mouchel) is registered in England and Wales with registered number 01686040 at Export House, Cawsey Way, Woking, Surrey, UK, GU21 6QX. The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel. No contracts may be concluded on behalf of Mouchel by means of email communications. Mouchel reserves the right to monitor and intercept emails sent and received on our network.
--
Andy,
Below is a small example of how you might do this using a compiled MapBasic script. Obviously you can use the same method to change brush styles as well, and you may want to run a check on each object before changing the style that it can accept the change (e.g. a line does not have a brush style). Hope this helps.
'=============================================================================================
Include "MapBasic.def"
Declare Sub Main
Declare Function UpdatePen(ByVal styleObj as Object, ByVal usePen as Pen) as Object
Sub Main
Dim strQueries(2) as String
Dim penStyle(2) as Pen
strQueries(1) = "Select * from Example where RowID > 5 Into ChangePen"
penStyle(1) = MakePen(1,2,BLACK)
strQueries(2) = "Select * from Example where RowID <= 5 Into ChangePen"
penStyle(2) = MakePen(1,2,RED)
For i = 1 to UBound(strQueries)
Run Command strQueries(1)
Update ChangePen set Obj = UpdatePen(obj, penStyle(i))
Commit table ChangePen
Close table ChangePen
Next
End Sub
Function UpdatePen(ByVal styleObj as Object, ByVal newPen as Pen) as Object
Alter object styleObj Info OBJ_INFO_PEN, newPen
UpdatePen = styleObj
End Sub
'=============================================================================================
Run Command strQueries(1)
should read…
Run Command strQueries(i)
Tom Bacon
GIS Engineer, Mouchel
T 01444 472380 │ E thomas...@mouchel.com │ W www.mouchel.com
Our values: innovation │ excellence │ integrity │ responsibility
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
-- Andy Harfoot GeoData Institute University of Southampton Southampton SO17 1BJ Tel: +44 (0)23 8059 2719 Fax: +44 (0)23 8059 2849 www.geodata.soton.ac.uk