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)
107 std::list<te::map::AbstractLayerPtr> singleLayers;
109 std::list<te::map::AbstractLayerPtr> allLayers = getAllLayers(invalid);
111 std::list<te::map::AbstractLayerPtr>::const_iterator it;
113 for(it = allLayers.begin(); it != allLayers.end(); ++it)
116 if(layer->getType() ==
"FOLDERLAYER")
127 std::list<te::map::AbstractLayerPtr> visibleSingleLayers;
129 std::list<te::map::AbstractLayerPtr> singleLayers = getSingleLayers(invalid);
131 std::list<te::map::AbstractLayerPtr>::const_iterator it;
132 for(it = singleLayers.begin(); it != singleLayers.end(); ++it)
137 visibleSingleLayers.push_back(singleLayer);
140 return visibleSingleLayers;
146 m_topLayers = layers;
153 std::list<te::map::AbstractLayerPtr>::const_iterator it = m_selectedLayers.begin();
155 std::list<te::map::AbstractLayerPtr> validLayers;
157 while(it != m_selectedLayers.end())
159 if(it->get()->isValid())
160 validLayers.push_back(it->get());
169 return m_selectedLayers;
175 m_selectedLayers.clear();
177 m_selectedLayers = selectedLayers;
183 m_topLayers.push_back(layer);
185 parentLayer->add(layer);
195 m_topLayers.
remove(layer);
197 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.