OverlayColors* ActionVisual::getColorOverlay(int32_t angle) { if (m_colorOverlayMap.empty()) { return 0; } int32_t closestMatch = 0; int32_t index = getIndexByAngle(angle, m_map, closestMatch); if (m_colorOverlayMap.find(index) == m_colorOverlayMap.end()) { return 0; } return &m_colorOverlayMap[getIndexByAngle(angle, m_map, closestMatch)]; }
int32_t Object::getRestrictedRotation(int32_t rotation) { int32_t closest = rotation; if (m_multiProperty) { if (!m_multiProperty->m_multiAngleMap.empty()) { getIndexByAngle(rotation, m_multiProperty->m_multiAngleMap, closest); } else if (!m_multiProperty->m_partAngleMap.empty()) { getIndexByAngle(rotation, m_multiProperty->m_partAngleMap, closest); } } else if (m_inherited) { return m_inherited->getRestrictedRotation(rotation); } return closest; }
std::vector<ModelCoordinate> Object::getMultiObjectCoordinates(int32_t rotation) const { std::vector<ModelCoordinate> coordinates; if (m_multiProperty) { if (m_multiProperty->m_multiObjectCoordinates.empty()) { std::set<Object*>::iterator subit = m_multiProperty->m_multiParts.begin(); for (; subit != m_multiProperty->m_multiParts.end(); ++subit) { const std::multimap<int32_t, ModelCoordinate>& subcoords = (*subit)->getMultiPartCoordinates(); m_multiProperty->m_multiObjectCoordinates.insert(subcoords.begin(), subcoords.end()); } std::multimap<int32_t, ModelCoordinate>::iterator it = m_multiProperty->m_multiObjectCoordinates.begin(); for (; it != m_multiProperty->m_multiObjectCoordinates.end(); ++it) { m_multiProperty->m_multiAngleMap[(*it).first] = (*it).first; } } int32_t closest = 0; getIndexByAngle(rotation, m_multiProperty->m_multiAngleMap, closest); std::pair<std::multimap<int32_t, ModelCoordinate>::iterator, std::multimap<int32_t, ModelCoordinate>::iterator> result = m_multiProperty->m_multiObjectCoordinates.equal_range(closest); std::multimap<int32_t, ModelCoordinate>::iterator it = result.first; ModelCoordinate parent(0,0); coordinates.push_back(parent); for (; it != result.second; ++it) { coordinates.push_back((*it).second); } } else if (m_inherited) { return m_inherited->getMultiObjectCoordinates(rotation); } return coordinates; }
OverlayColors* ObjectVisual::getStaticColorOverlay(int32_t angle) { if (m_colorOverlayMap.empty()) { return 0; } int32_t closestMatch = 0; return &m_colorOverlayMap[getIndexByAngle(angle, m_map, closestMatch)]; }
void ActionVisual::removeColorOverlay(int32_t angle) { if (m_colorOverlayMap.empty()) { return; } int32_t closestMatch = 0; int32_t index = getIndexByAngle(angle, m_map, closestMatch); m_colorOverlayMap.erase(index); //m_map.erase(index); }
void ActionVisual::removeColorOverlay(int32_t angle, int32_t order) { if (m_colorAnimationOverlayMap.empty()) { return; } int32_t closestMatch = 0; AngleColorAnimationOverlayMap::iterator it = m_colorAnimationOverlayMap.find(getIndexByAngle(angle, m_map, closestMatch)); if (it != m_colorAnimationOverlayMap.end()) { it->second.erase(order); } }
OverlayColors* ActionVisual::getColorOverlay(int32_t angle, int32_t order) { if (m_colorAnimationOverlayMap.empty()) { return 0; } int32_t closestMatch = 0; AngleColorAnimationOverlayMap::iterator it = m_colorAnimationOverlayMap.find(getIndexByAngle(angle, m_map, closestMatch)); if (it != m_colorAnimationOverlayMap.end()) { std::map<int32_t, OverlayColors>::iterator sit = it->second.find(order); if (sit != it->second.end()) { return &it->second[order]; } } return 0; }
std::vector<ModelCoordinate> Object::getMultiPartCoordinates(int32_t rotation) const { std::vector<ModelCoordinate> coordinates; if (m_multiProperty) { int32_t closest = 0; getIndexByAngle(rotation, m_multiProperty->m_partAngleMap, closest); std::pair<std::multimap<int32_t, ModelCoordinate>::iterator, std::multimap<int32_t, ModelCoordinate>::iterator> result = m_multiProperty->m_multiPartCoordinates.equal_range(closest); std::multimap<int32_t, ModelCoordinate>::iterator it = result.first; for (; it != result.second; ++it) { coordinates.push_back((*it).second); } } else if (m_inherited) { return m_inherited->getMultiPartCoordinates(rotation); } return coordinates; }
int32_t ObjectVisual::getClosestMatchingAngle(int32_t angle) { int32_t closestMatch = 0; getIndexByAngle(angle, m_angle2img, closestMatch); return closestMatch; }
int32_t ObjectVisual::getStaticImageIndexByAngle(int32_t angle) { int32_t closestMatch = 0; return getIndexByAngle(angle, m_angle2img, closestMatch); }
AnimationPtr ActionVisual::getAnimationByAngle(int32_t angle) { int32_t closestMatch = 0; return m_animation_map[getIndexByAngle(angle, m_map, closestMatch)]; }
void ActionVisual::removeAnimationOverlay(uint32_t angle, int32_t order) { int32_t closestMatch = 0; std::map<int32_t, AnimationPtr>& orderMap = m_animationOverlayMap[getIndexByAngle(angle, m_map, closestMatch)]; std::map<int32_t, AnimationPtr>::iterator it = orderMap.begin(); orderMap.erase(order); }
std::map<int32_t, AnimationPtr> ActionVisual::getAnimationOverlay(int32_t angle) { int32_t closestMatch = 0; return m_animationOverlayMap[getIndexByAngle(angle, m_map, closestMatch)]; }
int ActionVisual::getAnimationIndexByAngle(int angle) { int closestMatch = 0; return getIndexByAngle(angle, m_animations, closestMatch); }