コード例 #1
0
ファイル: rs_entity.cpp プロジェクト: Seablade/vec2web
/**
 * Is this entity visible?
 *
 * @return true Only if the entity and the layer it is on are visible.
 * The Layer might also be NULL. In that case the layer visiblity 
* is ignored.
 */
bool RS_Entity::isVisible() {

    if (!getFlag(RS2::FlagVisible)) {
        return false;
    }

    if (isUndone()) {
        return false;
    }

	/*RS_EntityCotnainer* parent = getParent();
	if (parent!=NULL && parent->isUndone()) {
		return false;
	}*/

    if (getLayer()==NULL) {
        return true;
    }

    // inserts are usually visible - the entities in them have their own
    //   layers which might be frozen
    // upd: i'm not sure if that is the best behaviour
    //if (rtti()==RS2::EntityInsert) {
    //	return true;
    //}

    if (layer!=NULL /*&& layer->getName()!="ByBlock"*/) {
        if (!layer->isFrozen()) {
            return true;
        } else {
            return false;
        }
    }

    if (layer==NULL /*&& getLayer()->getName()!="ByBlock"*/) {
        if (getLayer()==NULL) {
            return true;
        } else {
            if (!getLayer()->isFrozen()) {
                return true;
            } else {
                return false;
            }
        }
    }

    if (getBlockOrInsert()==NULL) {
        return true;
    }

    if (getBlockOrInsert()->rtti()==RS2::EntityBlock) {
        if (getLayer(false)==NULL || !getLayer(false)->isFrozen()) {
            return true;
        } else {
            return false;
        }
    }


    if (getBlockOrInsert()->getLayer()==NULL) {
        return true;
    }

    if(!getBlockOrInsert()->getLayer()->isFrozen()) {
        return true;
    }

    return false;
}
コード例 #2
0
ファイル: rs_entity.cpp プロジェクト: Aly1029/LibreCAD
/**
 * Is this entity visible?
 *
 * @return true Only if the entity and the layer it is on are visible.
 * The Layer might also be nullptr. In that case the layer visiblity
* is ignored.
 */
bool RS_Entity::isVisible() const{

    if (!getFlag(RS2::FlagVisible)) {
        return false;
    }

    if (isUndone()) {
        return false;
    }

        /*RS_EntityCotnainer* parent = getParent();
        if (parent && parent->isUndone()) {
                return false;
        }*/

	if (!getLayer()) {
        return true;
    }

    // inserts are usually visible - the entities in them have their own
    //   layers which might be frozen
    // upd: i'm not sure if that is the best behaviour
    //if (rtti()==RS2::EntityInsert) {
    //	return true;
    //}
    // blocks are visible in editting window, issue#253
    if( isDocument() && (rtti()==RS2::EntityBlock || rtti()==RS2::EntityInsert)) {
        return true;
    }

    if (layer /*&& layer->getName()!="ByBlock"*/) {

        if (!layer->isFrozen()) {
            return true;
        } else {
            return false;
        }
    }

	if (!layer /*&& getLayer()->getName()!="ByBlock"*/) {
		if (!getLayer()) {
            return true;
        } else {
            if (!getLayer()->isFrozen()) {
                return true;
            } else {
                return false;
            }
        }
    }

	if (!getBlockOrInsert()) {
        return true;
    }

    if (getBlockOrInsert()->rtti()==RS2::EntityBlock) {
		return !(getLayer(false) && getLayer(false)->isFrozen());
    }


	if (!getBlockOrInsert()->getLayer()) {
        return true;
    }

	if (!getBlockOrInsert()->getLayer()->isFrozen()) {
        return true;
    }

    return false;
}