/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #include "DgMultiVertexProperties.h" //----------------------------------------------------------------------------------------------------------------------- // OdDgMultiVertex2d //----------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------- // property: Vertices //----------------------------------------------------------------------------------------------------------------------- ODDG_DEFINE_RX_VALUE_ARRAY_ITERATOR(OdGePoint2d); OdRxValueIteratorPtr OdDgMultiVertex2dVerticesProperty::subNewValueIterator(const OdRxObject* pO) const { OdRxValueIteratorPtr res; res = OdRxObjectImpl::createObject(); OdDgMultiVertex2dPtr pObj = OdDgMultiVertex2d::cast(pO); if (!pObj.isNull()) { OdArray arrVertices; for (OdUInt32 i = 0; i < pObj->getVerticesCount(); i++) arrVertices.push_back(pObj->getVertexAt(i)); ((OdRxOdGePoint2dValueIterator*)res.get())->init(arrVertices, 0); } return res; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex2dVerticesProperty::subTryGetCount(const OdRxObject* pO, int& count) const { OdDgMultiVertex2dPtr pObj = OdDgMultiVertex2d::cast(pO); if (pObj.isNull()) return eNotApplicable; count = pObj->getVerticesCount(); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex2dVerticesProperty::subGetValue(const OdRxObject* pO, int index, OdRxValue& value) const { OdDgMultiVertex2dPtr pObj = OdDgMultiVertex2d::cast(pO); if (pObj.isNull()) return eNotApplicable; if (index < 0 || index >= (int)pObj->getVerticesCount()) return eInvalidIndex; value = pObj->getVertexAt(index); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex2dVerticesProperty::subChildren(OdArray& children) const { children.append(OdRxSubPropertyOfIndexedProperty::createObject(L"X", OdRxValueType::Desc::value(), this)); children.append(OdRxSubPropertyOfIndexedProperty::createObject(L"Y", OdRxValueType::Desc::value(), this)); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex2dVerticesProperty::subSetValue(OdRxObject* pO, int index, const OdRxValue& value) const { OdDgMultiVertex2dPtr pObj = OdDgMultiVertex2d::cast(pO); if (pObj.isNull()) return eNotApplicable; if (index < 0 || index >= (int)pObj->getVerticesCount()) return eInvalidIndex; pObj->setVertexAt(index, *rxvalue_cast(&value)); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex2dVerticesProperty::subInsertValue(OdRxObject* pO, int index, const OdRxValue& value) const { OdDgMultiVertex2dPtr pObj = OdDgMultiVertex2d::cast(pO); if (pObj.isNull()) return eNotApplicable; if (index < 0 || index >(int)pObj->getVerticesCount()) return eInvalidIndex; pObj->insertVertex(index, *rxvalue_cast(&value)); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex2dVerticesProperty::subRemoveValue(OdRxObject* pO, int index) const { OdDgMultiVertex2dPtr pObj = OdDgMultiVertex2d::cast(pO); if (pObj.isNull()) return eNotApplicable; if (index < 0 || index >= (int)pObj->getVerticesCount()) return eInvalidIndex; pObj->removeVertexAt(index); return eOk; } //----------------------------------------------------------------------------------------------------------------------- // OdDgMultiVertex3d //----------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------- // property: Vertices //----------------------------------------------------------------------------------------------------------------------- ODDG_DEFINE_RX_VALUE_ARRAY_ITERATOR(OdGePoint3d); OdRxValueIteratorPtr OdDgMultiVertex3dVerticesProperty::subNewValueIterator(const OdRxObject* pO) const { OdRxValueIteratorPtr res; res = OdRxObjectImpl::createObject(); OdDgMultiVertex3dPtr pObj = OdDgMultiVertex3d::cast(pO); if (!pObj.isNull()) { OdArray arrVertices; for (OdUInt32 i = 0; i < pObj->getVerticesCount(); i++) arrVertices.push_back(pObj->getVertexAt(i)); ((OdRxOdGePoint3dValueIterator*)res.get())->init(arrVertices, 0); } return res; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex3dVerticesProperty::subTryGetCount(const OdRxObject* pO, int& count) const { OdDgMultiVertex3dPtr pObj = OdDgMultiVertex3d::cast(pO); if (pObj.isNull()) return eNotApplicable; count = pObj->getVerticesCount(); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex3dVerticesProperty::subGetValue(const OdRxObject* pO, int index, OdRxValue& value) const { OdDgMultiVertex3dPtr pObj = OdDgMultiVertex3d::cast(pO); if (pObj.isNull()) return eNotApplicable; if (index < 0 || index >= (int)pObj->getVerticesCount()) return eInvalidIndex; value = pObj->getVertexAt(index); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex3dVerticesProperty::subChildren(OdArray& children) const { children.append(OdRxSubPropertyOfIndexedProperty::createObject(L"X", OdRxValueType::Desc::value(), this)); children.append(OdRxSubPropertyOfIndexedProperty::createObject(L"Y", OdRxValueType::Desc::value(), this)); children.append(OdRxSubPropertyOfIndexedProperty::createObject(L"Z", OdRxValueType::Desc::value(), this)); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex3dVerticesProperty::subSetValue(OdRxObject* pO, int index, const OdRxValue& value) const { OdDgMultiVertex3dPtr pObj = OdDgMultiVertex3d::cast(pO); if (pObj.isNull()) return eNotApplicable; if (index < 0 || index >= (int)pObj->getVerticesCount()) return eInvalidIndex; pObj->setVertexAt(index, *rxvalue_cast(&value)); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex3dVerticesProperty::subInsertValue(OdRxObject* pO, int index, const OdRxValue& value) const { OdDgMultiVertex3dPtr pObj = OdDgMultiVertex3d::cast(pO); if (pObj.isNull()) return eNotApplicable; if (index < 0 || index >(int)pObj->getVerticesCount()) return eInvalidIndex; pObj->insertVertex(index, *rxvalue_cast(&value)); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgMultiVertex3dVerticesProperty::subRemoveValue(OdRxObject* pO, int index) const { OdDgMultiVertex3dPtr pObj = OdDgMultiVertex3d::cast(pO); if (pObj.isNull()) return eNotApplicable; if (index < 0 || index >= (int)pObj->getVerticesCount()) return eInvalidIndex; pObj->removeVertexAt(index); return eOk; } //----------------------------------------------------------------------------------------------------------------------- // OdDgPointString2d //----------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------- // property: ContinuousFlag //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgPointString2dContinuousFlagProperty::subGetValue(const OdRxObject* pO, OdRxValue& value) const { OdDgPointString2dPtr pObj = OdDgPointString2d::cast(pO); if (pObj.isNull()) return eNotApplicable; value = pObj->getContinuousFlag(); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgPointString2dContinuousFlagProperty::subSetValue(OdRxObject* pO, const OdRxValue& value) const { OdDgPointString2dPtr pObj = OdDgPointString2d::cast(pO); if (pObj.isNull()) return eNotApplicable; pObj->setContinuousFlag(*rxvalue_cast(&value)); return eOk; } //----------------------------------------------------------------------------------------------------------------------- // OdDgPointString3d //----------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------- // property: ContinuousFlag //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgPointString3dContinuousFlagProperty::subGetValue(const OdRxObject* pO, OdRxValue& value) const { OdDgPointString3dPtr pObj = OdDgPointString3d::cast(pO); if (pObj.isNull()) return eNotApplicable; value = pObj->getContinuousFlag(); return eOk; } //----------------------------------------------------------------------------------------------------------------------- OdResult OdDgPointString3dContinuousFlagProperty::subSetValue(OdRxObject* pO, const OdRxValue& value) const { OdDgPointString3dPtr pObj = OdDgPointString3d::cast(pO); if (pObj.isNull()) return eNotApplicable; pObj->setContinuousFlag(*rxvalue_cast(&value)); return eOk; } //-----------------------------------------------------------------------------------------------------------------------