SgVector<SgPoint> SgNode::VectorProp(SgPropID prop) const { SgPropPointList* lp = dynamic_cast<SgPropPointList*>(Get(prop)); if (lp) return lp->Value(); return SgVector<SgPoint>(); }
void SgNode::SetListProp(SgPropID id, const SgVector<SgPoint>& value) { SgPropPointList* prop = dynamic_cast<SgPropPointList*>(Get(id)); if (prop) prop->SetValue(value); else { prop = static_cast<SgPropPointList*>(SgProp::CreateProperty(id)); prop->SetValue(value); Add(prop); } }
void YSgUtil::GetSetupPosition(const SgNode* node, const ConstBoard& cbrd, std::vector<cell_t>& black, std::vector<cell_t>& white, std::vector<cell_t>& empty) { black.clear(); white.clear(); empty.clear(); if (node->HasProp(SG_PROP_ADD_BLACK)) { SgPropPointList* prop = (SgPropPointList*)node->Get(SG_PROP_ADD_BLACK); const SgVector<SgPoint>& vec = prop->Value(); for (int i = 0; i < vec.Length(); ++i) black.push_back(YSgUtil::SgPointToYPoint(vec[i], cbrd)); } if (node->HasProp(SG_PROP_ADD_WHITE)) { SgPropPointList* prop = (SgPropPointList*)node->Get(SG_PROP_ADD_WHITE); const SgVector<SgPoint>& vec = prop->Value(); for (int i = 0; i < vec.Length(); ++i) white.push_back(YSgUtil::SgPointToYPoint(vec[i], cbrd)); } if (node->HasProp(SG_PROP_ADD_EMPTY)) { SgPropPointList* prop = (SgPropPointList*)node->Get(SG_PROP_ADD_EMPTY); const SgVector<SgPoint>& vec = prop->Value(); for (int i = 0; i < vec.Length(); ++i) empty.push_back(YSgUtil::SgPointToYPoint(vec[i], cbrd)); } }