Search in sources :

Example 6 with LINK_VARIANT

use of eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT in project Eidolons by IDemiurge.

the class HT_MapBuilder method getLinkVariant.

protected LINK_VARIANT getLinkVariant(ObjType type, int i, int sublingCount) {
    LINK_VARIANT variant = getDefaultLinkVariant();
    Integer circle = type.getIntParam(PARAMS.CIRCLE);
    String linkName = type.getProperty(PROPS.LINK_VARIANT);
    if (linkName.isEmpty()) {
        if (!isAddLinkPerChild()) {
            List<ObjType> typesOnRow = getTypesWithinRange(type, sublingCount, sublingCount, 64, 64);
            ObjType parent = DataManager.getParent(type);
            if (typesOnRow.size() >= 1) {
                int index = 0;
                while (index < typesOnRow.size()) {
                    if (alteredTypeLinkMap.containsKey(DataManager.getParent(typesOnRow.get(index)))) {
                        // TODO short? if any
                        return LINK_VARIANT.VERTICAL;
                    }
                    // in
                    // line are long!
                    index++;
                }
                LogMaster.log(1, type.getName() + "*!* Link made LONG! - " + typesOnRow);
                alteredTypeLinkMap.put(parent, type);
                return LINK_VARIANT.VERTICAL_LONG;
            }
        } else {
            if (sublingCount > 1) {
                if (sublingCount % 2 == 1) {
                    if ((i == sublingCount / 2)) {
                        // getSpecialLink?
                        variant = getDefaultLinkVariant();
                    } else if (i < sublingCount / 2) {
                        linkName += "ANGLE_TO_LEFT";
                    } else {
                        linkName += "ANGLE_TO_RIGHT";
                    }
                } else if (i % 2 == 0) {
                    linkName += "ANGLE_TO_LEFT";
                } else {
                    linkName += "ANGLE_TO_RIGHT";
                }
            }
            if (!linkName.isEmpty()) {
                if (circle > 0 && circle < 4) {
                    linkName += circle;
                }
            }
        }
    }
    if (!linkName.isEmpty()) {
        variant = new EnumMaster<LINK_VARIANT>().retrieveEnumConst(LINK_VARIANT.class, linkName);
    }
    if (variant == null) {
        variant = getDefaultLinkVariant();
    }
    return variant;
}
Also used : ObjType(main.entity.type.ObjType) EnumMaster(main.system.auxiliary.EnumMaster) LINK_VARIANT(eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)

Example 7 with LINK_VARIANT

use of eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT in project Eidolons by IDemiurge.

the class HT_View method selectAltLink.

private String selectAltLink(String name, String prevData) {
    LINK_VARIANT variant;
    variant = new EnumMaster<LINK_VARIANT>().retrieveEnumConst(LINK_VARIANT.class, new ListChooser(SELECTION_MODE.SINGLE, LINK_VARIANT.class).choose());
    if (variant == null) {
        if (prevData != null) {
        } else {
            return null;
        }
    }
    String offsetX = "" + DialogMaster.inputInt("offset x", 0);
    String offsetY = "" + DialogMaster.inputInt("offset y", 0);
    String offsets = offsetX + "," + offsetY;
    String suffix = (variant + "");
    suffix += "=" + offsets;
    String value = name + StringMaster.wrapInParenthesis(suffix);
    return value;
}
Also used : EnumMaster(main.system.auxiliary.EnumMaster) LINK_VARIANT(eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT) ListChooser(main.swing.generic.components.editors.lists.ListChooser)

Example 8 with LINK_VARIANT

use of eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT in project Eidolons by IDemiurge.

the class HT_MapBuilder method adjustLink.

private boolean adjustLink(StaticTreeLink link, boolean moreVertical) {
    LINK_VARIANT variant = getShiftedLinkVariant(link.getVariant(), moreVertical);
    LogMaster.log(1, "***** vertical= " + moreVertical + " => adjusted to " + variant + "  [" + link);
    if (variant == null) {
        return false;
    }
    if (variant == link.getVariant()) {
        return false;
    }
    link.setVariant(variant);
    return true;
}
Also used : LINK_VARIANT(eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)

Aggregations

LINK_VARIANT (eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)8 ObjType (main.entity.type.ObjType)3 EnumMaster (main.system.auxiliary.EnumMaster)3 PointX (main.swing.PointX)2 ListChooser (main.swing.generic.components.editors.lists.ListChooser)2 HT_Node (eidolons.client.cc.gui.neo.tree.HT_Node)1