Title: RE: [MI-L] Make a whole in a region object
Well, if you need to do this 100 times a day, I can see a need for a tool that makes this process easier.
 
1. Draw hole with special tool
- 1a. The hole searches for objects in a certain layer, could be the editable layer
- 1b. For each found object, it erases the part of the object, that is within the hole
 
1 step is a lot easier than 7 ;-)
 
And I can even give you some part of the code, bear with me as I don't have MapBasic Help or my normal editor here to help me check the spelling and the defines and functions used:
 
Sub ToolEraser
'**This is the procedure called by your toolbutton,
'**that should have a POLYGON draw_mode
 
Dim  oEraser, oToBeErased As Object,
     nMID, nRowID As Integer,
     sLayer As String
 
  oEraser = CommandInfo(CMD_INFO_COSTUM_OBJ)
  nMID = FrontWindow()
  '**Check that the frontwindow exists and is a mapper
 
  sLayer = MapperInfo(nMID, MAPPER_INFO_EDITABLE_LAYER)
 
  Select * from sLayer
     Where OBJ Intersects oEraser
     Into OBJS__TO__ERASE NoSelect
 
   Fetch First From OBJS__TO__ERASE
   Do Until EOT(OBJS__TO__ERASE)
      nRowID = OBJS__TO__ERASE.ROWID
      oToBeErased = OBJS__TO__ERASE.OBJ
      oToBeErased = Erase(oToBeErased, oEraser)
 
      Update OBJS__TO__ERASE
         Set OBJ = oToBeErased
         Where ROWID = nRowID
 
      Fetch Next From OBJS__TO__ERASE
   Loop
 
End Sub
 
This is pretty much what you need. I you want to store the Eraser object, you just need to insert that into a layer at the end of the procedure
HTH,
 
Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
5260 Odense S.
Denmark
 
Tel   + 45 6311 4900
Dir   +45 6311 4908
Mob +45 5156 1045
Fax  + 45 6311 4949
E-mail [EMAIL PROTECTED]


From: [EMAIL PROTECTED] on behalf of Warren Vick, Europa Technologies Ltd.
Sent: Fri 14-Jul-06 10:33
To: 'Mapinfo-L'
Subject: RE: [MI-L] Make a whole in a region object

and don't' forget to:

7) Delete "hole"

I can't remember how many times I've left an "eraser" object in a layer by
accident.

Regards,
Warren Vick
Europa Technologies Ltd.
http://www.europa-tech.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Uffe
Kousgaard
Sent: 14 July 2006 07:54
To: Mapinfo-L
Subject: Re: [MI-L] Make a whole in a region object


This is already possible with a few steps in MapInfo. I don't think you can
make it much simpler by writing a tool.

1) Make layer editable
2) Select the region
3) Objects > Set Target (ctrl T)
4) Draw "hole"
5) Select "hole"
6) Objects > Erase

Done.

Kind regards

Uffe Kousgaard
www.routeware.dk

----- Original Message -----
From: "Boyd Townsend" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, July 14, 2006 8:03 AM
Subject: [MI-L] Make a whole in a region object


> Can anyone assist.
>
> I am wanting to develop a simple tool for a user which will essentialy
> make a hole in a region object.
>
> For example.
>
> We have a region object which depicts an area of land burnt by fire.
> Within that region there are small pockets which were not burnt. We would
> like to be able to draw in those unburnt portions into the existing
> region.
>
> Essentially the user would draw a small area within the existing
> region
> which would then be erased from that region making a hole in it. (If this
> makes Sense).
>
> Can anyone make a suggestion on what road I would best take to acheive
> this???
>
> In anticipation - Thanks
>
> Boyd Townsend
> CSO - Northern Rivers
> NSW Rural Fire Service
>
>
> This email message is intended only for the addressee(s) and contains
> information which may be confidential.
> If you are not the intended recipient, please notify the sender and delete

> this email and any copies or
> links to this email completely and immediately from your system. Views
> expressed in this message are
> those of the individual sender, and are not necessarily the views of the
> NSW Rural Fire Service.
>
> _______________________________________________
> MapInfo-L mailing list
> [email protected]
> http://www.directionsmag.com/mailman/listinfo/mapinfo-l

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l




_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l



_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to