79 std::list<te::map::AbstractLayerPtr> layers;
81 std::list<te::map::AbstractLayerPtr>::const_iterator it;
83 for(it = m_topLayers.begin(); it != m_topLayers.end(); ++it)
87 if(!invalid && !topLevelLayer->isValid())
92 layers.push_back(topLevelLayer);
94 if(topLevelLayer->getType() ==
"FOLDERLAYER")
96 std::vector<te::map::AbstractLayer*> children = topLevelLayer->getDescendants();
97 for(std::size_t i = 0; i < children.size(); ++i)
99 if(!invalid && !children[i]->isValid())
115 std::list<te::map::AbstractLayerPtr> singleLayers;
117 std::list<te::map::AbstractLayerPtr> allLayers = getAllLayers(invalid);
119 std::list<te::map::AbstractLayerPtr>::const_iterator it;
121 for(it = allLayers.begin(); it != allLayers.end(); ++it)
124 if(layer->getType() ==
"FOLDERLAYER")
135 std::list<te::map::AbstractLayerPtr> visibleSingleLayers;
137 std::list<te::map::AbstractLayerPtr> singleLayers = getSingleLayers(invalid);
139 std::list<te::map::AbstractLayerPtr>::const_iterator it;
140 for(it = singleLayers.begin(); it != singleLayers.end(); ++it)
145 visibleSingleLayers.push_back(singleLayer);
148 return visibleSingleLayers;
154 m_topLayers = layers;
161 std::list<te::map::AbstractLayerPtr>::const_iterator it = m_selectedLayers.begin();
163 std::list<te::map::AbstractLayerPtr> validLayers;
165 while(it != m_selectedLayers.end())
167 if(it->get()->isValid())
168 validLayers.push_back(it->get());
177 return m_selectedLayers;
183 m_selectedLayers.clear();
185 m_selectedLayers = selectedLayers;
191 m_topLayers.push_back(layer);
193 parentLayer->add(layer);
203 m_topLayers.
remove(layer);
205 parentLayer->remove(layer->getIndex());
bool hasChanged()
It informs if the project has changed.
const std::string & getTitle() const
It gets the title of the project.
void add(const te::map::AbstractLayerPtr &layer, const te::map::AbstractLayerPtr &parentLayer=te::map::AbstractLayerPtr())
It adds the specified layer to the list of layers of the parent layer. If the parent layer is not spe...
This is the base class for layers.
This class models the concept of a project for the TerraLib Application Framework.
const std::list< te::map::AbstractLayerPtr > & getTopLayers() const
It gets all the top layers of the project (folder and single layers).
const std::list< te::map::AbstractLayerPtr > getSelectedLayers(bool invalid=true) const
It gets all the layers that are selected.
std::list< te::map::AbstractLayerPtr > getAllLayers(bool invalid=true)
It gets all the layers (single and folder layers) of the project.
void setProjectAsChanged(const bool &changed)
It sets the project status as changed or not.
void setTitle(const std::string &title)
It sets the title of the project.
TreeItemPtr remove(std::size_t i)
It removes the i-th child.
std::list< te::map::AbstractLayerPtr > getSingleLayers(bool invalid=true)
It gets all the single layers of the project.
void setAuthor(const std::string &author)
It sets the author of the project.
void setTopLayers(const std::list< te::map::AbstractLayerPtr > &layers)
It sets the top layers of the project.
void setFileName(const std::string &fName)
It sets the filename where the project will be saved.
void setSelectedLayers(const std::list< te::map::AbstractLayerPtr > &selectedLayers)
It sets all the layers that are selected.
const std::string & getAuthor() const
It gets the author of the project.
void clear()
It clears the project, setting it as having no layers.
const std::string & getFileName() const
It gets the filename where the project is saved.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::list< te::map::AbstractLayerPtr > getVisibleSingleLayers(bool invalid=true)
It gets all the single layers that are visible.
void remove(const te::map::AbstractLayerPtr &layer)
It removes the specified layer from the project.