TopographyFile::TopographyFile(struct zzip_dir *_dir, const char *filename, fixed _threshold, fixed _label_threshold, fixed _important_label_threshold, const Color _color, int _label_field, ResourceId _icon, ResourceId _big_icon, unsigned _pen_width) :dir(_dir), first(NULL), label_field(_label_field), icon(_icon), big_icon(_big_icon), pen_width(_pen_width), color(_color), scale_threshold(_threshold), label_threshold(_label_threshold), important_label_threshold(_important_label_threshold), cache_bounds(GeoBounds::Invalid()) { if (msShapefileOpen(&file, "rb", dir, filename, 0) == -1) return; if (file.numshapes == 0) { msShapefileClose(&file); return; } shapes.ResizeDiscard(file.numshapes); std::fill(shapes.begin(), shapes.end(), ShapeList(NULL)); if (dir != NULL) ++dir->refcount; ++serial; }
TopographyFile::TopographyFile(struct zzip_dir *_dir, const char *filename, fixed _threshold, fixed _label_threshold, fixed _important_label_threshold, const Color thecolor, int _label_field, int _icon, int _pen_width) :dir(_dir), first(NULL), label_field(_label_field), icon(_icon), pen_width(_pen_width), color(thecolor), scale_threshold(_threshold), label_threshold(_label_threshold), important_label_threshold(_important_label_threshold) { if (msShapefileOpen(&file, "rb", dir, filename, 0) == -1) return; if (file.numshapes == 0) { msShapefileClose(&file); return; } shapes.resize_discard(file.numshapes); std::fill(shapes.begin(), shapes.end(), ShapeList(NULL)); if (dir != NULL) ++dir->refcount; cache_bounds.west = cache_bounds.east = cache_bounds.south = cache_bounds.north = Angle::zero(); }
TopographyFile::TopographyFile(zzip_dir *_dir, const char *filename, double _threshold, double _label_threshold, double _important_label_threshold, const Color _color, int _label_field, ResourceId _icon, ResourceId _big_icon, unsigned _pen_width) :dir(_dir), first(nullptr), label_field(_label_field), icon(_icon), big_icon(_big_icon), pen_width(_pen_width), color(_color), scale_threshold(_threshold), label_threshold(_label_threshold), important_label_threshold(_important_label_threshold), cache_bounds(GeoBounds::Invalid()) { if (msShapefileOpen(&file, "rb", dir, filename, 0) == -1) return; if (file.numshapes == 0) { msShapefileClose(&file); return; } const auto file_bounds = ImportRect(file.bounds); if (!file_bounds.Check()) { /* malformed bounds */ msShapefileClose(&file); return; } center = file_bounds.GetCenter(); shapes.ResizeDiscard(file.numshapes); std::fill(shapes.begin(), shapes.end(), ShapeList(nullptr)); if (dir != nullptr) ++dir->refcount; ++serial; }
ShapeList ShapeList::scaled( double s ) { return static_cast<ShapeList&>( ShapeList( *this ).scale( s, s ) ); }
ShapeList ShapeList::scaled( double sx, double sy ) { return static_cast<ShapeList&>( ShapeList( *this ).scale( sx, sy ) ); }
ShapeList ShapeList::translated( double dx, double dy ) { return static_cast<ShapeList&>( ShapeList( *this ).translate( dx, dy ) ); }
ShapeList ShapeList::rotated( double angle ) { return static_cast<ShapeList&>( ShapeList( *this ).rotate( angle, center() ) ); }