Example #1
0
void Topology::Open() {
  shapefileopen = false;

  #if USETOPOMARKS
  if (append) {
    if (msSHPOpenFile(&shpfile, (char*)"rb+", filename) == -1) {
      // StartupStore(_T(". Topology: Open: append failed for <%s> (this can be normal)%s"),filename,NEWLINE);
      return;
    }
  } else {
  #endif
    if (msSHPOpenFile(&shpfile, (char*)"rb", filename) == -1) {
      StartupStore(_T("------ Topology: Open FAILED for <%s>%s"),filename,NEWLINE);
      return;
    }
  #if USETOPOMARKS
  }
  #endif
  // StartupStore(_T(". Topology: Open <%s>%s"),filename,NEWLINE);

  scaleThreshold = 1000.0;
  shpCache = (XShape**)malloc(sizeof(XShape*)*shpfile.numshapes);
  if (shpCache) {
    shapefileopen = true;
#ifdef TOPOFASTCACHE
	initCache();
#else
    for (int i=0; i<shpfile.numshapes; i++) {
      shpCache[i] = NULL;
    }
#endif
  } else {
	StartupStore(_T("------ ERR Topology,  malloc failed shpCache%s"), NEWLINE);
  }
}
Example #2
0
void Topology::Open() {
  shapefileopen = false;

  if (append) {
    if (msSHPOpenFile(&shpfile, "rb+", filename) == -1) {
      return;
    }
  } else {
    if (msSHPOpenFile(&shpfile, "rb", filename) == -1) {
      return;
    }
  }

  scaleThreshold = 1000.0;
  shpCache = (XShape**)malloc(sizeof(XShape*)*shpfile.numshapes);
  if (shpCache) {
    shapefileopen = true;
    for (int i=0; i<shpfile.numshapes; i++) {
      shpCache[i] = NULL;
    }
  }
}