⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qgsgrassprovider.h

📁 一个非常好的GIS开源新版本
💻 H
📖 第 1 页 / 共 2 页
字号:
  /** Get updated line    */  int updatedLine ( int idx );  /** Get updated node    */  int updatedNode ( int idx );  /** Find nearest line    *   @param threshold maximum distance   *   @return line number   *   @return 0 nothing found   */  int findLine ( double x, double y, int type, double threshold );  /** Find nearest node    *   @param threshold maximum distance   *   @return node number   *   @return 0 nothing found   */  int findNode ( double x, double y, double threshold );  /** Get columns' definitions   *   @param field   *   @param cat   *   @return vector of attributes   */  std::vector<QgsField> *columns ( int field );  /** Read attributes from DB   *   @param field   *   @param cat   *   @return vector of attributes   */  QgsAttributeMap *attributes ( int field, int cat );  /** Key (cat) column name    *   @param field   *   @return Key column name or empty string    */  QString *key ( int field );  /** Get number of db links    *   @return number of links    */  int numDbLinks ( void );  /** Get db link field   *  @param link   *   @return field number or 0    */  int dbLinkField ( int link );  /** Execute SQL statement    *   @param field   *   @param sql    *   @return empty string or error message    */  QString *executeSql ( int field, const QString &sql );  /** Update attributes    *   @param field   *   @param cat   *   @param update comma separated update string, e.g.: col1 = 5, col2 = 'Val d''Aosta'   *   @return empty string or error message    */  QString *updateAttributes ( int field, int cat, const QString &values );  /** Insert new attributes to the table (it does not check if attributes already exists)   *   @param field   *   @param cat   *   @return empty string or error message    */  QString *insertAttributes ( int field, int cat );  /** Delete attributes from the table    *   @param field   *   @param cat   *   @return empty string or error message    */  QString *deleteAttributes ( int field, int cat );  /** Check if a database row exists and it is orphan (no more lines with   *  that category)     *   @param field   *   @param cat   *   @param orphan set to true if a record exits and it is orphan   *   @return empty string or error message    */  QString *isOrphan ( int field, int cat, int *orphan);  /** Create table and link vector to this table   *   @param field   *   @param columns SQL definition for columns, e.g. cat integer, label varchar(10)    *   @return empty string or error message   */  QString *createTable ( int field, const QString &key, const QString &columns );  /** Add column to table   *   @param field   *   @param column SQL definition for columns, e.g. label varchar(10)    *   @return empty string or error message   */  QString *addColumn ( int field, const QString &column );  /* Following functions work only until first edit operation! (category index used) */	  /** Get number of fields in category index */  int cidxGetNumFields ( void );  /** Get field number for index */  int cidxGetFieldNumber ( int idx );  /** Get maximum category for field index */  int cidxGetMaxCat ( int idx );    /** Returns GRASS layer number */  int grassLayer();  /** Returns GRASS layer number for given layer name or -1 if cannot    *  get layer number   */  static int grassLayer(QString);  /** Returns GRASS layer type (GV_POINT, GV_LINES, GV_AREA) for    *  given layer name or -1 if cannot get layer type   */  static int grassLayerType(QString);    /** return a provider name    Essentially just returns the provider key.  Should be used to build file    dialogs so that providers can be shown with their supported types. Thus    if more than one provider supports a given format, the user is able to    select a specific provider to open that file.    @note    Instead of being pure virtual, might be better to generalize this    behavior and presume that none of the sub-classes are going to do    anything strange with regards to their name or description?    */    QString name() const;    /** return description    Return a terse string describing what the provider is.    @note    Instead of being pure virtual, might be better to generalize this    behavior and presume that none of the sub-classes are going to do    anything strange with regards to their name or description?    */    QString description() const;private:  // Layer type (layerType)  enum    TYPE {   // layer name:      POINT = 1,   // <field>_point      LINE,        // <field>_line      POLYGON,     // <field>_polygon      BOUNDARY,    // boundary (currently not used)      CENTROID     // centroid (currently not used)  };  QString mGisdbase;      // map gisdabase  QString mLocation;      // map location name (not path!)  QString mMapset;        // map mapset  QString mMapName;       // map name  QString mLayer;         // layer name  int     mLayerField;    // field part of layer or -1 if no field specified  int     mLayerType;     // layer type POINT, LINE, ...  int     mGrassType;     // grass feature type: GV_POINT, GV_LINE | GV_BOUNDARY, GV_AREA,   // ( GV_BOUNDARY, GV_CENTROID )  QGis::WKBTYPE mQgisType;// WKBPoint, WKBLineString, ...  int     mLayerId;       // ID used in layers  struct  Map_info *mMap; // vector header pointer  int     mMapVersion;    // The version of the map for which the instance was last time updated	  struct line_pnts *mPoints; // points structure   struct line_cats *mCats;   // cats structure  struct ilist     *mList;   int    mCidxFieldIndex;    // !UPDATE! Index for layerField in category index or -1 if no such field  int    mCidxFieldNumCats;  // !UPDATE! Number of records in field index  int    mNextCidx;          // !UPDATE! Next index in cidxFieldIndex to be read, used to find nextFeature  // selection: array of size nlines or nareas + 1, set to 1 - selected or 0 - not selected, 2 - read  // Code 2 means that the line was already read in this cycle, all 2 must be reset to 1  // if getFirstFeature() or select() is calles.   // Distinction between 1 and 2 is used if attribute table exists, in that case attributes are  // read from the table and geometry is append and selection set to 2.  // In the end the selection array is scanned for 1 (attributes missing), and the geometry   // is returned without attributes  char    *mSelection;           // !UPDATE!  int     mSelectionSize;        // !UPDATE! Size of selection array  bool    mValid;                // !UPDATE!   long    mNumberFeatures;       // !UPDATE!  void resetSelection(bool sel); // reset selection  // Reopen map after edit or freeze  bool reopenMap();  // -----------------------------------------------------------------------------------------  /* Static variables and methods.   * These methods opens GRASS vectors and loads some parts of vectors to the memory.   * it maintains the list of opened layers so that sources are not duplicated in the memory.    * Layers are identified by layer ID.    * The layers have unique URI, if next layer of the same URI is requested,    * nUsers is increased and ID of the layer which is already opened is returned.   * Attributes are loaded from DB and stored in the memory when layer is opened.   */  /*! Open layer. Layer for QgsGrassVector means Map+field   *  @param gisdbase    *  @param location   *  @param mapset   *  @param mapName   *  @param field   *  @return layer ID   *  @return -1 cannot open   */  static int openLayer(QString gisdbase, QString location, QString mapset, QString mapName, int field);  /*! Load sources from the map.   *  Must be set: layer.mapId, layer.map, layer.field   *  Updates: layer.fieldInfo, layer.nColumns, layer.nAttributes, layer.attributes, layer.keyColumn   *  Unchanged: layer.valid   *   *  Old sources are released, namely: layer.fields and layer.attributes   *   *  layer.attributes must be pointer to existing array or 0   */  static void loadLayerSourcesFromMap ( GLAYER &layer );  /*! Load attributes from database table.   *  Must be set: layer.mapId, layer.map, layer.field   *  Updates: layer.fieldInfo, layer.nColumns, layer.nAttributes, layer.attributes, layer.keyColumn   *  Unchanged: layer.valid   *   *  Old sources are released, namely: layer.attributes   *   *  layer.attributes must be pointer to existing array or 0   */  static void loadAttributes ( GLAYER &layer );  /*! Close layer.    *  @param layerId    */  static void closeLayer( int layerId );  /*! Open map.    *  @param gisdbase    *  @param location   *  @param mapset   *  @param mapName   *  @return map ID   *  @return -1 cannot open   */  static int openMap(QString gisdbase, QString location, QString mapset, QString mapName);  /*! Close map.    *  @param mapId    */  static void closeMap( int mapId );  /*! Update map. Close and reopen vector, all layers in mLayers using this map are also updated.   *  Instances of QgsGrassProvider are not updated and should call update() method.   *  @param mapId    */  static void updateMap( int mapId );  /*! The map is outdated. The map was for example rewritten by GRASS module outside QGIS.   *  This function checks internal timestamp stored in QGIS.   *  @param mapId    */  static bool mapOutdated( int mapId );  /*! The attributes are outdated. The table was for example updated by GRASS module outside QGIS.   *  This function checks internal timestamp stored in QGIS.   *  @param mapId    */  static bool attributesOutdated( int mapId );  /*! Allocate sellection array for given map id. The array is large enough for lines or areas   *  (bigger from num lines and num areas)   *  Possible old selection array is not released.   *  @param map pointer to map structure    *  @param selection pointer to pointer to char array   *  @return selection size   */  static int allocateSelection(  struct Map_info *map, char **selection );	  /*! Get layer map.    *  @param layerId    *  @return pointer to Map_info structure   */  static struct Map_info *layerMap( int layerId );	  /*! Get attribute by category(key) and attribute number.    *  @param layerId    *  @param category (key)    *  @param column column number ( < nColumns )    *  @return pointer to string representation of the value or NULL, this value must not be changed   */  static char *attribute( int layerId, int cat, int column );	  /*! Set feature attributes.    *  @param layerId   *  @param feature   *  @param cat category number   */  void setFeatureAttributes ( int layerId, int cat, QgsFeature *feature);  /*! Set feature attributes.    *  @param layerId   *  @param feature   *  @param cat category number   *  @param attlist a list containing the index number of the fields to set   */  void setFeatureAttributes ( int layerId, int cat, QgsFeature *feature, const QgsAttributeList & attlist);  /* Static arrays of opened layers and vectors */  static 	std::vector<GLAYER> mLayers; // Map + field/attributes  static 	std::vector<GMAP> mMaps;     // Map};#endif // QGSGRASSPROVIDER_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -