/** * Loads geometry data from the ESRI shape file * * @return boolean|void * @see ShapeFile::_loadRecords() */ public function _loadRecords() { global $eof; ImportShp::readFromBuffer(32); while (true) { $record = new ShapeRecord(-1); $record->loadFromFile($this->SHPFile, $this->DBFFile); if ($record->lastError != "") { return false; } if ($eof) { break; } $this->records[] = $record; } }
/** * Loads data from a polyline record * * @return void * @see ShapeRecord::_loadPolyLineRecord() */ public function _loadPolyLineRecord() { $this->SHPData = array(); $this->SHPData["xmin"] = loadData("d", ImportShp::readFromBuffer(8)); $this->SHPData["ymin"] = loadData("d", ImportShp::readFromBuffer(8)); $this->SHPData["xmax"] = loadData("d", ImportShp::readFromBuffer(8)); $this->SHPData["ymax"] = loadData("d", ImportShp::readFromBuffer(8)); $this->SHPData["numparts"] = loadData("V", ImportShp::readFromBuffer(4)); $this->SHPData["numpoints"] = loadData("V", ImportShp::readFromBuffer(4)); for ($i = 0; $i < $this->SHPData["numparts"]; $i++) { $this->SHPData["parts"][$i] = loadData("V", ImportShp::readFromBuffer(4)); } $readPoints = 0; reset($this->SHPData["parts"]); while (list($partIndex, ) = each($this->SHPData["parts"])) { if (!isset($this->SHPData["parts"][$partIndex]["points"]) || !is_array($this->SHPData["parts"][$partIndex]["points"])) { $this->SHPData["parts"][$partIndex] = array(); $this->SHPData["parts"][$partIndex]["points"] = array(); } while (!in_array($readPoints, $this->SHPData["parts"]) && $readPoints < $this->SHPData["numpoints"]) { $this->SHPData["parts"][$partIndex]["points"][] = $this->_loadPoint(); $readPoints++; } } }