Ignore:
Timestamp:
Apr 15, 2010, 10:40:35 PM (15 years ago)
Author:
Pieter Naber
Message:

Created interlinks!
Fixed LogHandler to output at the end (so we have a valid KML file)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/inc/KMLLine.class.php

    r7765 r7773  
    1919                        </description>
    2020                        <LookAt>
    21                                 <longitude>%LONGITUDE%</longitude>
    22                                 <latitude>%LATITUDE%</latitude>
     21                                <longitude>%LONGITUDE1%</longitude>
     22                                <latitude>%LATITUDE1%</latitude>
    2323                                <altitude>0</altitude>
    2424                                <heading>0</heading>
     
    2929                        <LineString>
    3030                                <coordinates>
    31                                         %X1%, %Y1%, 0.
    32                                         %X2%, %Y2%, 0.
     31                                        %LONGITUDE1%, %LATITUDE1%, 0.
     32                                        %LONGITUDE2%, %LATITUDE2%, 0.
    3333                                </coordinates>
    3434                        </LineString>
     
    3838        private $name;                                  // Name of the line
    3939        private $description;                   // Description of the line
    40         private $longitude;                             // Longitude of the line
    41         private $latitude;                              // Latitude of the line
    4240        private $style;                                 // Style of the line
    43         private $x1;                                    // Start X of line
    44         private $y1;                                    // Start Y of line
    45         private $x2;                                    // End X of line
    46         private $y2;                                    // End Y of line
     41        private $longitude1;                    // Start longitude of line
     42        private $latitude1;                             // Start latitude of line
     43        private $longitude2;                    // End longitude of line
     44        private $latitude2;                             // End latitude of line
    4745
    4846        /*
     
    5957                $this->latitude = 0;
    6058                $this->style = LINE_BLACK;
    61                 $this->x1 = 0;
    62                 $this->y1 = 0;
    63                 $this->x2 = 0;
    64                 $this->y2 = 0;
     59                $this->longitude1 = 0;
     60                $this->latitude1 = 0;
     61                $this->longitude2 = 0;
     62                $this->latitude2 = 0;
    6563        }
    6664
     
    106104
    107105        /*
    108          * Function: setLongitude
    109          * Description: Setting the longitude of the placemark
    110          * Parameters: double $newLongitude
    111          * Returns: -
    112          */
    113         function setLongitude($newLongitude) {
    114                 $this->longitude = (double) $newLongitude;
    115         }
    116 
    117         /*
    118          * Function: setLatitude
    119          * Description: Setting the latitude of the placemark
    120          * Parameters: double $newLatitude
    121          * Returns: -
    122          */
    123         function setLatitude($newLatitude) {
    124                 $this->latitude = (double) $newLatitude;
    125         }
    126 
    127         /*
    128106         * Function: setStyle
    129107         * Description: Setting the style of the placemark
     
    136114
    137115        /*
    138          * Function: setX1
    139          * Description: Setting the X1 of the placemark
    140          * Parameters: double $newX1
     116         * Function: setLongitude1
     117         * Description: Setting the longitude1 of the placemark
     118         * Parameters: double $newLongitude
    141119         * Returns: -
    142120         */
    143         function setX1($newX1) {
    144                 $this->x1 = (double) $newX1;
     121        function setLongitude1($newLongitude) {
     122                $this->longitude1 = (double) $newLongitude;
     123        }
     124
     125        /*
     126         * Function: setLatitude1
     127         * Description: Setting the latitude1 of the placemark
     128         * Parameters: double $newLatitude
     129         * Returns: -
     130         */
     131        function setLatitude1($newLatitude) {
     132                $this->latitude1 = (double) $newLatitude;
    145133        }
    146134       
    147135        /*
    148          * Function: setY1
    149          * Description: Setting the Y1 of the placemark
    150          * Parameters: double $newY1
     136         * Function: setLongitude2
     137         * Description: Setting the longitude2 of the placemark
     138         * Parameters: double $newLongitude
    151139         * Returns: -
    152140         */
    153         function setY1($newY1) {
    154                 $this->y1 = (double) $newY1;
     141        function setLongitude2($newLongitude) {
     142                $this->longitude2 = (double) $newLongitude;
    155143        }
    156        
     144
    157145        /*
    158          * Function: setX2
    159          * Description: Setting the X2 of the placemark
    160          * Parameters: double $newX2
     146         * Function: setLatitude2
     147         * Description: Setting the latitude2 of the placemark
     148         * Parameters: double $newLatitude
    161149         * Returns: -
    162150         */
    163         function setX2($newX2) {
    164                 $this->x2 = (double) $newX2;
     151        function setLatitude2($newLatitude) {
     152                $this->latitude2 = (double) $newLatitude;
    165153        }
    166        
     154
    167155        /*
    168          * Function: setY2
    169          * Description: Setting the Y2 of the placemark
    170          * Parameters: double $newY2
    171          * Returns: -
     156         * Function: isConnected
     157         * Description: Check if it is really a line or just a dot
     158         * Parameters: -
     159         * Returns: true if the line is connected, otherwise false
    172160         */
    173         function setY2($newY2) {
    174                 $this->y2 = (double) $newY2;
     161        function isConnected() {
     162                if (($this->latitude2 == 0) || ($this->longitude2 == 0)) {
     163                        return false;
     164                }
     165
     166                // This is a line!
     167                return true;
    175168        }
    176169
     
    187180                $toString = str_replace('%NAME%', $this->name, $toString);
    188181                $toString = str_replace('%DESCRIPTION%', $this->description, $toString);
    189                 $toString = str_replace('%LONGITUDE%', $this->longitude, $toString);
    190                 $toString = str_replace('%LATITUDE%', $this->latitude, $toString);
    191182                $toString = str_replace('%STYLE%', $this->style, $toString);
    192                 $toString = str_replace('%X1%', $this->x1, $toString);
    193                 $toString = str_replace('%Y1%', $this->y1, $toString);
    194                 $toString = str_replace('%X2%', $this->x2, $toString);
    195                 $toString = str_replace('%Y2%', $this->y2, $toString);
     183                $toString = str_replace('%LONGITUDE1%', $this->longitude1, $toString);
     184                $toString = str_replace('%LATITUDE1%', $this->latitude1, $toString);
     185                $toString = str_replace('%LONGITUDE2%', $this->longitude2, $toString);
     186                $toString = str_replace('%LATITUDE2%', $this->latitude2, $toString);
    196187
    197188                return $toString;
Note: See TracChangeset for help on using the changeset viewer.