69 std::vector< const CLRenderInformationBase * > referenceChain;
73 while (pCurrent != NULL)
76 if (std::find(referenceChain.begin(), referenceChain.end(), pCurrent) != referenceChain.end())
82 referenceChain.push_back(pCurrent);
86 if (!referenceKey.empty())
88 if (local && localList.size() != 0)
90 size_t j = 0, jMax = localList.size();
94 if (localList[j]->getKey() == referenceKey)
105 if (!pNext && globalList.size() != 0)
107 size_t j = 0, jMax = globalList.size();
111 if (globalList[j]->getKey() == referenceKey)
140 std::map<std::string, const CLStyle*> keyMap;
141 std::map<std::string, const CLStyle*> typeMap;
142 std::map<std::string, const CLStyle*> roleMap;
143 std::map<std::string, const CLColorDefinition*> colors;
144 std::map<std::string, const CLLineEnding*> lineEndings;
145 std::map<std::string, const CLGradientBase*> gradients;
146 std::vector< const CLRenderInformationBase * >::const_iterator it = referenceChain.begin(), endit = referenceChain.end();
159 iMax = (*it)->getListOfColorDefinitions()->size();
161 for (i = 0; i < iMax; ++i)
163 pColorDefinition = (*it)->getColorDefinition(i);
165 if (colors.find(pColorDefinition->
getId()) == colors.end())
167 colors.insert(std::pair<std::string, const CLColorDefinition*>(pColorDefinition->
getId(), pColorDefinition));
171 iMax = (*it)->getListOfGradientDefinitions()->size();
173 for (i = 0; i < iMax; ++i)
175 pGradientBase = (*it)->getGradientDefinition(i);
177 if (gradients.find(pGradientBase->
getId()) == gradients.end())
179 gradients.insert(std::pair<std::string, const CLGradientBase*>(pGradientBase->
getId(), pGradientBase));
183 iMax = (*it)->getListOfLineEndings()->size();
185 for (i = 0; i < iMax; ++i)
187 pLineEnding = (*it)->getLineEnding(i);
189 if (lineEndings.find(pLineEnding->
getId()) == lineEndings.end())
191 lineEndings.insert(std::pair<std::string, const CLLineEnding*>(pLineEnding->
getId(), pLineEnding));
197 if (pRenderInformation)
202 for (i = 0; i < iMax; ++i)
204 pStyle = pRenderInformation->
getStyle(i);
205 const std::set<std::string>& idSet = pStyle->
getKeyList();
206 std::set<std::string>::const_iterator sIt = idSet.begin(), sEndit = idSet.end();
208 while (sIt != sEndit)
210 if (keyMap.find(*sIt) == keyMap.end())
212 keyMap.insert(std::pair<std::string, const CLStyle*>(*sIt, pStyle));
218 const std::set<std::string>& roleSet = pStyle->
getRoleList();
220 sIt = roleSet.begin();
222 sEndit = roleSet.end();
224 while (sIt != sEndit)
226 if (roleMap.find(*sIt) == roleMap.end())
228 roleMap.insert(std::pair<std::string, const CLStyle*>(*sIt, pStyle));
234 const std::set<std::string>& typeSet = pStyle->
getTypeList();
236 sIt = typeSet.begin();
238 sEndit = typeSet.end();
240 while (sIt != sEndit)
242 if (typeMap.find(*sIt) == typeMap.end())
244 typeMap.insert(std::pair<std::string, const CLStyle*>(*sIt, pStyle));
254 assert(pGlobalRenderInformation);
258 for (i = 0; i < iMax; ++i)
260 pStyle = pGlobalRenderInformation->
getStyle(i);
261 const std::set<std::string>& roleSet = pStyle->
getRoleList();
262 std::set<std::string>::const_iterator sIt = roleSet.begin(), sEndit = roleSet.end();
264 while (sIt != sEndit)
266 if (roleMap.find(*sIt) == roleMap.end())
268 roleMap.insert(std::pair<std::string, const CLStyle*>(*sIt, pStyle));
274 const std::set<std::string>& typeSet = pStyle->
getTypeList();
276 sIt = typeSet.begin();
278 sEndit = typeSet.end();
280 while (sIt != sEndit)
282 if (typeMap.find(*sIt) == typeMap.end())
284 typeMap.insert(std::pair<std::string, const CLStyle*>(*sIt, pStyle));
296 std::map<const CLStyle*, std::vector<std::set<std::string> > > styles;
297 std::map<std::string, const CLStyle*>::const_iterator mapIt = keyMap.begin(), mapEndit = keyMap.end();
299 while (mapIt != mapEndit)
301 if (styles.find(mapIt->second) == styles.end())
306 styles[mapIt->second] = std::vector<std::set<std::string> >(3);
309 styles[mapIt->second][0].insert(mapIt->first);
313 mapIt = roleMap.begin();
314 mapEndit = roleMap.end();
316 while (mapIt != mapEndit)
318 if (styles.find(mapIt->second) == styles.end())
323 styles[mapIt->second] = std::vector<std::set<std::string> >(3);
326 styles[mapIt->second][1].insert(mapIt->first);
330 mapIt = typeMap.begin();
331 mapEndit = typeMap.end();
333 while (mapIt != mapEndit)
335 if (styles.find(mapIt->second) == styles.end())
340 styles[mapIt->second] = std::vector<std::set<std::string> >(3);
343 styles[mapIt->second][2].insert(mapIt->first);
351 std::map<const CLStyle*, std::vector<std::set<std::string> > >::const_iterator styleIt = styles.begin(), styleEndit = styles.end();
354 while (styleIt != styleEndit)
359 if (dynamic_cast<const CLLocalStyle*>(styleIt->first))
365 pLocalStyle = convertGlobalToLocalStyle(static_cast<const CLGlobalStyle*>(styleIt->first));
376 std::map<const CLStyle*, std::vector<std::set<std::string> > >::const_iterator styleIt = styles.begin(), styleEndit = styles.end();
378 while (styleIt != styleEndit)
386 std::map<std::string, const CLColorDefinition*>::const_iterator colorIt = colors.begin(), colorEndit = colors.end();
388 while (colorIt != colorEndit)
394 std::map<std::string, const CLGradientBase*>::const_iterator gradientIt = gradients.begin(), gradientEndit = gradients.end();
396 while (gradientIt != gradientEndit)
402 std::map<std::string, const CLLineEnding*>::const_iterator lineIt = lineEndings.begin(), lineEndit = lineEndings.end();
404 while (lineIt != lineEndit)
void setGroup(const CLGroup *pGroup)
const std::string & getObjectName() const
virtual size_t size() const
const std::string & getId() const
const std::set< std::string > & getKeyList() const
const std::set< std::string > & getRoleList() const
static CLLocalStyle * convertGlobalToLocalStyle(const CLGlobalStyle *pGlobal)
const std::set< std::string > & getTypeList() const
const CLGroup * getGroup() const
void setTypeList(const std::set< std::string > &typeList)
static CLGlobalRenderInformation * flatten_render_information(const CLGlobalRenderInformation &globalRenderInformation, const CCopasiVector< CLGlobalRenderInformation > &globalList)
const std::string & getId() const
const std::string & getId() const
void setRoleList(const std::set< std::string > &roleList)
bool setObjectName(const std::string &name)
static CLRenderInformationBase * flatten(const CLRenderInformationBase &renderInformation, const CCopasiVector< CLGlobalRenderInformation > &globalList, const CCopasiVector< CLLocalRenderInformation > &localList=CCopasiVector< CLLocalRenderInformation >())