Re: MI-L Mapbasic: Creating polylines with multiple sections

2005-01-17 Thread Robert Crossley
Maybe the easiest way would be to create these segments as an array of  
separate polyline objects, and then combine them into one when you have  
finished.

r
On Mon, 17 Jan 2005 16:44:45 +0800, David Baker [EMAIL PROTECTED] wrote:
I have a MapBasic 4.5 command:
	Alter Object TempPolyLine Node Add Position PolylineSections,  
ObjectInfo(TempPolyLine, OBJ_INFO_NPNTS) + 1 (PointLong, PointLat)

TempPolyLine is my polyline which was originally created with:
Create Pline Into Variable TempPolyLine 0
PolylineSections is a SmallInt value (one or larger), identifying one  
section from a
polyline object.

ObjectInfo(TempPolyLine, OBJ_INFO_NPNTS) + 1 is of course the number  
of
existing nodes + 1, to refer to my new node number that I am about to  
create.

PointLat  PointLong are my Latitude  Longitude of the node I want to  
create.


I am reading in polylines from another file format (Garmin .mp polish  
format). These
polylines have multiple sections, so I want to create the MapInfo  
polylines with the same
multiple sections.

All works well while PolylineSections is 1, but as soon as I try to add  
the first node after
changing PolylineSections to 2, I get a MapBasic error:

Alter Object Node Add failure
Am I trying to do this the wrong way? Can I just keep adding points   
the new section
will be created automatically, or am I missing some command to inform  
MapBasic that I
am adding in a new section?

Thanks,
Dave

-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14872


--

Robert Crossley
Agtrix P/L
9 Short St
PO Box 63
New Brighton 2483
Far Southern Queensland
AUSTRALIA
153.549004 E 28.517344 S
P: 02 6680 1309
F: 02 6680 5214
M: 0419 718 642
E: [EMAIL PROTECTED]
W: www.agtrix.com
W: www.wotzhere.com
-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14873


RE: MI-L Mapbasic: Creating polylines with multiple sections

2005-01-17 Thread Peter Horsbøll Møller
If you look at the syntax for create Polyline, I think you need to specify how 
many segments it should contain:

Create Pline 
[  Into  { Window   window_id  |  Variable   var_name } ] 
[ Multiple num_sections ]
num_points
 ( x1,  y1)  ( x2,  y2)  [ ... ]

If is the Multiple num_sections I'm refering to.

But, I think this was added in a later version of MapInfo, and it is not 
available in MB 4.5
So I guess you have to create only single segment polylines, and then combine 
them everytime you shift to next segment

Something like this:

Do While (...)
'**Here you read the segment#, point# and the coordinates

If nCurSegm  nNextSegm Then
If nNumSegment = 0 Then

ElseIf nNumSegment = 1 then
oMultiSegment = oSingleSegment
else
oMultiSegment = Combine(oMultiSegment, oSingleSegment)
End if

Create PLine Into Variable TempPolyLine 0   

nNumSegment = nNumSegment + 1
End if

'**Here you add the nodes
Loop

Peter Horsbøll Møller
GIS Developer
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  [EMAIL PROTECTED]
http://www.cowi.dk/gis


-Original Message-
From: David Baker [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 17, 2005 9:45 AM
To: MapInfo-L@lists.directionsmag.com
Subject: MI-L Mapbasic: Creating polylines with multiple sections


I have a MapBasic 4.5 command:

Alter Object TempPolyLine Node Add Position PolylineSections, 
ObjectInfo(TempPolyLine, OBJ_INFO_NPNTS) + 1 (PointLong, PointLat)

TempPolyLine is my polyline which was originally created with:

Create Pline Into Variable TempPolyLine 0

PolylineSections is a SmallInt value (one or larger), identifying one section 
from a 
polyline object.

ObjectInfo(TempPolyLine, OBJ_INFO_NPNTS) + 1 is of course the number of 
existing nodes + 1, to refer to my new node number that I am about to create.

PointLat  PointLong are my Latitude  Longitude of the node I want to create.



I am reading in polylines from another file format (Garmin .mp polish 
format). These 
polylines have multiple sections, so I want to create the MapInfo polylines 
with the same 
multiple sections.

All works well while PolylineSections is 1, but as soon as I try to add the 
first node after 
changing PolylineSections to 2, I get a MapBasic error:

Alter Object Node Add failure

Am I trying to do this the wrong way? Can I just keep adding points  the new 
section 
will be created automatically, or am I missing some command to inform MapBasic 
that I 
am adding in a new section?

Thanks,

Dave




-
List hosting provided by Directions Magazine | www.directionsmag.com | To 
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14872



-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14874



RE: MI-L Mapbasic: Creating polylines with multiple sections

2005-01-17 Thread David Baker
On 17 Jan 2005 at 10:37, Peter Horsbøll Møller [EMAIL PROTECTED] wrote:

 If you look at the syntax for create Polyline, I think you need to specify
 how many segments it should contain:

 But, I think this was added in a later version of MapInfo, and it is not
 available in MB 4.5 So I guess you have to create only single segment
 polylines, and then combine them everytime you shift to next segment

Thanks Peter (and Robert). You are correct that this parameter isn't in 4.5, so 
your 
lateral thinking got me out of trouble.

   ElseIf nNumSegment = 1 then
oMultiSegment = oSingleSegment
   else
oMultiSegment = Combine(oMultiSegment, oSingleSegment)
   End if

This idea works nicely.

Excellent - I can hang onto my MapBasic 4.5 a little bit longer. :-)

Dave

-
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 14877