Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IfcPolyline and AbstractEList #1252

Open
dkurillo opened this issue May 18, 2022 · 2 comments
Open

IfcPolyline and AbstractEList #1252

dkurillo opened this issue May 18, 2022 · 2 comments

Comments

@dkurillo
Copy link

dkurillo commented May 18, 2022

According to IFC specification for IfcPolyline (https://standards.buildingsmart.org/IFC/DEV/IFC4_3/RC2/HTML/schema/ifcgeometryresource/lexical/ifcpolyline.htm)

 If the first and the last Cartesian point in the list are identical, then the polyline is a closed curve, otherwise it is an open curve

But if you to add the same point to polyline.getPoints() list it won't work because org.eclipse.emf.common.util.AbstractEList checks for contains:

public boolean add(E object) {
        if (this.isUnique() && this.contains(object)) {
            return false;
        } else {
            this.addUnique(object);
            return true;
        }
    }

How to define closed polyline in BimServer?

@dkurillo dkurillo changed the title IfcPolyline and AsbtractEList IfcPolyline and AbstractEList May 18, 2022
@dkurillo
Copy link
Author

Sorry, it was my fault. I get first and last point from the cache. That's why they look identical to the list

@hlg
Copy link
Member

hlg commented May 24, 2022

In fact, org.eclipse.emf.common.util.AbstractEList only checks for containment and refuses addition if the list is a unique list and hence isUnique() returns true. The Ecore model defines no uniqueness for the Points feature of IfcPolyline.

<eClassifiers xsi:type="ecore:EClass" name="IfcPolyline" eSuperTypes="//IfcBoundedCurve">
    <eStructuralFeatures xsi:type="ecore:EReference" name="Points" unique="false" upperBound="-1" eType="//IfcCartesianPoint"/>
</eClassifiers>

I have been confused by the method name addUnique(E object) in the past. It does not check for uniqueness. Whereas add(E object) does the check, addUnique(...) assumes the check to be done already and does not care.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants