A much faster way to do this is to write a function to do the
update. Take a look at ALterObject() here:
include "mapbasic.def"
declare sub main
declare Sub ResymbolizeRoad
declare function AlterObject(
byval objLine as object,
byval penObj as pen)
as object
sub main
call ResymbolizeRoad
end sub
Sub ResymbolizeRoad
dim penObj as Pen
penObj = MakePen(1,2,RED)
select * from dcdb where object into dcdbroad noselect
update dcdbroad set obj=AlterObject(dcdbroad.obj, penObj)
End Sub
function AlterObject (
byval objLine as object, 'original object
byval penObj as pen) 'pen style desired
as object 'altered object
dim objRoad as object
objRoad = objLine
alter object objRoad Info OBJ_INFO_PEN, penObj
AlterObject = objRoad
end function
'--- end
- Bill Thoen
Paul Grambauer wrote:
>
> Eric,
> Try this
>
> ' Change the border of all road parcels to color Red
>
> Sub ResymbolizeRoad
>
> Dim objElem As Object
> Dim penObj As Pen
>
> select * from dcdb where object into dcdbroad
> for i = 1 to tableinfo(dcdbroad,TAB_INFO_NROWS)
> fetch rec i from dcdbroad
> penObj = MakePen(1,2,RED)
> objElem = DCDBROAD.obj
> Alter Object objElem Info OBJ_INFO_PEN, penObj
> Update DCDBROAD Set obj = objElem Where RowID = i
> next
>
> End Sub
>
> Hope it helps,
>
> Paul Grambauer
> Cessnock City Council
> PO Box 152,
> 68-72 Vincent St,
> Cessnock, 2325
> Phone : +61 02 49934192
> Fax : +61 02 49934200
> Email : [EMAIL PROTECTED]
>
> ----------
> From: Eric Frost[SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, January 19, 2000 9:16 AM
> To: [EMAIL PROTECTED]
> Subject: MI Updating Object Styles
>
> Mappers:
>
> Is there a way to update an object's style programmatically
> without recreating the object?
>
> A snippet of sample code from the MapBasic Help file says:
>
> 'set a new "current symbol style"
> sSymbolAttr = "(35,65280,22)"
> sCmd = "Set Style Symbol MakeSymbol" + sSymbolAttr
> Run Command sCmd
>
> ' use an Update statement to create a new Point for
> ' every row in the Selection table. Each new Point
> ' will use the new "current symbol style"
> Update "Selection"
> Set obj = CreatePoint(CentroidX(obj),CentroidY(obj))
>
> However, I need to do this for polygons!
>
> When working in MapInfo, I can go to "Options | Region Style"
> and modify editable, selected objects in the current window..
> but that doesn't seem to work from within MapBasic (?)
>
> I understand maybe I need to loop through each polygon and
> modify them using Alter Object?
>
> Thanks in advance for any insight!
>
> Eric
>
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
>
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]