Mappoint Directions Property

Rund um MS-MapPoint

Moderator: Moderatoren

Antworten
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Mappoint Directions Property

Beitrag von AUGE_OHR »

ich lege mal für den Buchstaben D einen neuen Thread an.

Was ist Directions ?

Ich würde als Zusammenfassung sagen : Das was man bei einem Auto-Navi auf den Monitor
bekommt. Damit meine ich z.b. rechts/links "Pfeile" als optische Hinweise die man allerdings
erst selbst "malen" muss. Man kann nur die Eigenschaften (Property) abfragen (read only)
und bekommt eine Zahl = GeoDirectionAction Wert zurück. Diese kann man dann auch
für die Sprachausgabe verwenden. (z.b. Speech v5.x API SDK )

!!! Achtung : In der MP2004 gehen die GeoDirectionAction Werte nur bis 12, aber es wird
auch 14 zurück gegeben was wiederum mit der MP2006 übereinstimmt.
Auch hat sich 11 und 12 in der MP2006 gegenüber MP2004 geändert !!!

Was will ich mit Directions ?

ich wollte ja mal raus finden was meine Waypoints für Directions Eigenschaften haben.

Was ist zu beachten ?

klar das erst mindesten 2 Waypoints gesetzt sein müssen UND es muss ein Calculate() erfolgt
sein sonst gibt es NIL ...

nach dem ich das nun endlich rausgefunden hatte wollte ich nun anhand der Item:Directions
Eigenschaften die Waypoints analysieren und ggf. Delete()

Code: Alles auswählen

   //
   // no :Directions() when not :Calculate()
   //
   ::oMap:ActiveMap:ActiveRoute:Calculate()
   //
   //
   //
   imax := ::oMap:ActiveMap:ActiveRoute:Waypoints:Count()
   IF imax > 1
      FOR i := iMax TO 2 STEP -1
ALTD()
         //
         // get Action from every Item
         //
         nAction := ::oMap:ActiveMap ; // MAP
                     :ActiveRoute    ; // ROUTE
                     :Directions()   ; // DIRECTIONS
                     :Item(i)        ; // ITEM
                     :Action           // geo*
         lUseit := .F.
         DO CASE
         CASE nAction =  geoActionDepart            //  1 Abfahrt von einem
...
         ENDCASE

         IF lUseit = .T.
         ELSE
ALTD()
            ::oMap:ActiveMap:ActiveRoute:Waypoints:Item(i):Delete()
         ENDIF
      NEXT
   ELSE
      TONE(1000)
   ENDIF
tja leider hat die Sachen einen Harken ... es funktioniert nicht :(
je nachdem wie die FOR/NEXT Scheife raus/runter zählt knallt er beim Item( i )

er macht in diesem Beispiel z.b. iMax := 12, den löscht er nun dann wären es doch 11 ?
komme ich nun in der FOR/NEXT auf das "nAction :=" wo es ja auch ein Item( i )
gibt dann knallt es ... bei 11

zähle ich ihn hoch von 1 bis iMax knallt es "unten" beim Delete() ...

ich bin mit meinem Latein am Ende ... jemand einen Tip ?
gruss by OHR
Jimmy
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: Mappoint Directions Property

Beitrag von AUGE_OHR »

hier das Errorlog
------------------------------------------------------------------------------
FEHLERPROTOKOLL von "D:\ALASKA\Map\MAPP.EXE" Datum: 26.09.08 08:31:52

Xbase++ Version : Xbase++ (R) Version 1.90.331
Betriebssystem : Windows XP 05.01 Build 02600 Service Pack 2
------------------------------------------------------------------------------
oError:args :
-> VALTYPE: U VALUE: NIL
-> VALTYPE: N VALUE: 11
oError:canDefault : N
oError:canRetry : N
oError:canSubstitute: J
oError:cargo : NIL
oError:description : Parameter hat falschen Typ
oError:filename :
oError:genCode : 2
oError:operation : Item
oError:osCode : 0
oError:severity : 2
oError:subCode : 1025
oError:subSystem : BASE
oError:thread : 1
oError:tries : 0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Aufgerufen von XBMAP:DIRANALYZE(203)
Aufgerufen von XBMAP:MAPBABNO(649)
Aufgerufen von (B)XBMAP:CREATE(118)
Aufgerufen von MAIN(831)
gruss by OHR
Jimmy
Benutzeravatar
brandelh
Foren-Moderator
Foren-Moderator
Beiträge: 15688
Registriert: Mo, 23. Jan 2006 20:54
Wohnort: Germersheim
Hat sich bedankt: 65 Mal
Danksagung erhalten: 33 Mal
Kontaktdaten:

Re: Mappoint Directions Property

Beitrag von brandelh »

Hallo Jimmy,

das ist aber nicht Xbase++ Syntax oder ?

Code: Alles auswählen

   nAction := ::oMap:ActiveMap ; // MAP
                     :ActiveRoute    ; // ROUTE
                     :Directions()   ; // DIRECTIONS
                     :Item(i)        ; // ITEM
                     :Action           // geo*
die Errorlog sagt eindeutig, dass du ein NIL und 11 als Parameter übergibst,
also ist einer der Arrayelemente oder die Variable die du verwendest NIL.
Gruß
Hubert
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: Mappoint Directions Property

Beitrag von AUGE_OHR »

moin,
brandelh hat geschrieben: das ist aber nicht Xbase++ Syntax oder ?

Code: Alles auswählen

   nAction := ::oMap:ActiveMap      ; // MAP
                    :ActiveRoute    ; // ROUTE
                    :Directions     ; // DIRECTIONS
                    :Item(i)        ; // ITEM
                    :Action           // geo*
doch man kann Xbase++ so schreiben ... ich fand es schöner wegen den Parameter :)
brandelh hat geschrieben: die Errorlog sagt eindeutig, dass du ein NIL und 11 als Parameter übergibst,
also ist einer der Arrayelemente oder die Variable die du verwendest NIL.
Ja :Item(i) ist wohl der Ausdruck. Wenn ich nun die 11 bekomme habe ich wohl i, aber wo
ist dann das Item geblieben ... ?

Ich habe nach dem

Code: Alles auswählen

         ::oMap:ActiveMap:ActiveRoute:Waypoints:Item(i):callMethod("Delete")
nZahl := ::oMap:ActiveMap:ActiveRoute:Waypoints:Count()
eingebaut und das sagt es seien noch 11 !
gruss by OHR
Jimmy
Benutzeravatar
brandelh
Foren-Moderator
Foren-Moderator
Beiträge: 15688
Registriert: Mo, 23. Jan 2006 20:54
Wohnort: Germersheim
Hat sich bedankt: 65 Mal
Danksagung erhalten: 33 Mal
Kontaktdaten:

Re: Mappoint Directions Property

Beitrag von brandelh »

AUGE_OHR hat geschrieben:moin,
brandelh hat geschrieben: das ist aber nicht Xbase++ Syntax oder ?

Code: Alles auswählen

   nAction := ::oMap:ActiveMap      ; // MAP
                    :ActiveRoute    ; // ROUTE
                    :Directions     ; // DIRECTIONS
                    :Item(i)        ; // ITEM
                    :Action           // geo*
doch man kann Xbase++ so schreiben ... ich fand es schöner wegen den Parameter :)
jetzt bin ich aber verwirrt.
Ich kenne :: als self, das ist das Objekt selbst
::oMap ist eine Referenz auf das ActiveX Objekt
::oMap:ActiveMap ruft die Methode ActiveMap von ::oMap auf ... soweit so klar.
:ActiveRoute - hier würde ich vermuten, dass ein Fehler kommt,
was nimmt er denn hier nun ?
::oMap:ActiveRoute oder ::oMap:ActiveMap:ActiveRoute ...

Wo hast du denn diese Syntax her ?
Ist die nur für ActiveX ?

Sehr seltsam das alles :?
Gruß
Hubert
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: Mappoint Directions Property

Beitrag von AUGE_OHR »

hi,
brandelh hat geschrieben: ::oMap:ActiveRoute oder ::oMap:ActiveMap:ActiveRoute ...
Wo hast du denn diese Syntax her ?
Ist die nur für ActiveX ?
Bei Mappoint hat man wie beim WMPlayer eine Hierarchie in der Class

::oMap -> ActiveX selbst
::oMap:ActiveMap -> active MAP
::oMap:ActiveMap:ActiveRoute -> aktuelle Route der Map
::oMap:ActiveMap:ActiveRoute:Directions -> Class Directions
::oMap:ActiveMap:ActiveRoute:Directions:Item(i) -> laufendes Item der Direction
::oMap:ActiveMap:ActiveRoute:Directions:Item(i):Action -> GeoDirectionAction Wert

Tatsächlich nimmt Xbase bei Class auch Leerzeichen bzw ";" als Umbruch an sodas man

Code: Alles auswählen

::oMap   :ActiveMap   :ActiveRoute   :Directions   :Item(i)   :Action
schreiben kann und mit ";" steht es dann untereinander und man kann rechts nach "//"
die Parameter schön auflisten.
gruss by OHR
Jimmy
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12903
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 44 Mal

Re: Mappoint Directions Property

Beitrag von AUGE_OHR »

hi,
Directions-Auflistung
... Jede Fahrtanweisung kann untergeordnete Anweisungen enthalten.
wenn ich

Code: Alles auswählen

   ::oAXControl:ActiveMap:ActiveRoute:Directions:SetProperty(;
                                                   "Expanded", geoTrue )
   iMax := ::oAXControl:ActiveMap:ActiveRoute:Waypoints:count()
   FOR i = 1 TO iMax
      nProz := INT(i/iMax*100)
      IF (nProz % 1) == 0
         cProz := LTRIM(STR(nProz))
         ::oAnzeig:setcaption("Point2DBF"+Chr(13)+cProz+" %")
      ENDIF
      //
      // Start,Zwischen,Ende
      //
? "************************************************************"
?      ::oAXControl:ActiveMap:ActiveRoute:Waypoints:Item(i):Name
? "************************************************************"
      //
      // Sub-Anweisungen zwischsen 2 Waypoints
      //
      oSub := NIL
      oSub := ::oAXControl:ActiveMap:ActiveRoute:Waypoints:Item(i):SegmentDirections

altd()
      IF NIL = oSub
         jMax := 1
?        oSub:Item(1):ElapsedDistance
?        oSub:Item(1):Type
?        oSub:Item(1):Instruction
?        oSub:Item(1):Toward
         IF ::lSpeech
            nNo := oSub:Item(1):Action
            ::Anweisung(nNo)
         ENDIF

      ELSE
         jMax := oSub:count
         FOR j:= 1 TO jMax
? ""
?           ALLTRIM(STR(oSub:Item(j):ElapsedDistance,2))
            nType := oSub:Item(j):Type

/*
geoWaypointStart  1 Ausgangspunkt
geoWaypointStop   2 Zwischenstopp
geoWaypointEnd    3 Zielpunkt
*/
            DO CASE
               CASE nType = geoWaypointStart ; ?? " KM, Start"
               CASE nType = geoWaypointStop  ; ?? " KM, Kunde"
               CASE nType = geoWaypointEnd   ; ?? " KM, Ende "
            ENDCASE

??           oSub:Item(j):Instruction
?           oSub:Item(j):Toward
            IF ::lSpeech
               nNo := oSub:Item(j):Action
               ::Anweisung(nNo)
            ENDIF
         NEXT

      ENDIF

   NEXT
so das müsste es sein ...
gruss by OHR
Jimmy
Antworten