27 #include "../../datatype/SimpleProperty.h" 28 #include "../../graph/core/AbstractGraph.h" 29 #include "../../graph/core/GraphMetadata.h" 30 #include "../../graph/core/Vertex.h" 31 #include "../../graph/iterator/MemoryIterator.h" 32 #include "../../memory/DataSet.h" 33 #include "../../memory/DataSetItem.h" 86 std::unique_ptr<te::mem::DataSet> dataSet =
createDataSet(dsType.get());
89 if(dsType.get() && dataSet.get())
91 dataSet->moveBeforeFirst();
93 std::map<std::string, std::string> options;
95 ds->createDataSet(dsType.get(), options);
97 ds->add(dataSetName, dataSet.get(), options);
107 dataSetType->add(idxProperty);
111 pkName+=
"_" + dataSetName;
113 pk->
add(idxProperty);
116 for(
int i = 0; i <
m_graph->getMetadata()->getVertexPropertySize(); ++i)
127 dataSetType->add(newProp);
145 while(!it->isVertexIteratorAfterEnd())
151 int idx = v->
getId();
154 outDSetItem->
setInt32(
"index", idx);
157 std::vector<te::dt::AbstractData*> adVec = v->
getAttributes();
159 std::map<int, std::string>::iterator itMap = propMap.begin();
161 while(itMap != propMap.end())
165 outDSetItem->
setValue(itMap->second, adClone);
171 outDataset->add(outDSetItem);
173 v = it->getNextVertex();
181 std::map<int, std::string> propMap;
183 for(
int i = 0; i <
m_graph->getMetadata()->getVertexPropertySize(); ++i)
190 propMap.insert(std::map<int, std::string>::value_type(i, prop->
getName()));
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
An atomic property like an integer or double.
#define TE_SA_GEOMETRY_ATTR_NAME
boost::shared_ptr< DataSource > DataSourcePtr
A class that models the description of a dataset.
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.
static te::dt::Date ds(2010, 01, 01)
std::vector< te::dt::AbstractData * > & getAttributes()
It returns the vector of attributes associated with this element.
std::unique_ptr< te::da::DataSetType > createDataSetType(std::string dataSetName)
virtual Property * clone() const =0
It returns a clone of the object.
It models a property definition.
std::unique_ptr< te::mem::DataSet > createDataSet(te::da::DataSetType *dsType)
std::map< int, std::string > getGPMPropertyMap()
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
void setId(unsigned int id)
It sets the property identifier.
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
void setDataSetName(const std::string &dataSetName)
GeneralizedProximityMatrix()
Default constructor.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
virtual AbstractData * clone() const =0
It returns a clone of this object.
A base class for values that can be retrieved from the data access module.
#define TE_SA_GPM_ATTR_PK_NAME
virtual ~GeneralizedProximityMatrix()
Virtual destructor.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
std::string getDataSetName()
std::unique_ptr< te::graph::AbstractGraph > m_graph
Graph that represents the gpm.
std::string getAttributeName()
It describes a primary key (pk) constraint.
void toDataSource(te::da::DataSourcePtr ds, std::string dataSetName)
Function used to export the all vertex attributes from gpm graph to a datasource. ...
int getId()
It returns the vertex id.
std::string m_attributeName
Attribute used to identify the attr from dataset associated to this gmp.
void setAttributeName(const std::string &attrName)
std::string m_dataSetName
Attribute used to identify the dataset associated to this gpm.
void setGraph(te::graph::AbstractGraph *graph)
te::graph::AbstractGraph * getGraph()
const std::string & getName() const
It returns the property name.
This class defines the GPM class.
void setParent(Property *p)
It associate this property to the informed parent.