use of eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT in project Eidolons by IDemiurge.
the class HT_View method adjustLink.
public void adjustLink(Boolean vertical_horizontal_manual, HT_Node node) {
ObjType type = node.getType();
LINK_VARIANT variant = null;
if (tree.getMap().getLinkForChildType(type) != null) {
variant = tree.getMap().getLinkForChildType(type).getVariant();
}
if (variant == null || vertical_horizontal_manual == null) {
variant = new EnumMaster<LINK_VARIANT>().retrieveEnumConst(LINK_VARIANT.class, new ListChooser(SELECTION_MODE.SINGLE, LINK_VARIANT.class).choose());
} else {
variant = HT_MapBuilder.getShiftedLinkVariant(variant, vertical_horizontal_manual);
}
if (variant == null) {
LogMaster.log(1, type + "'s LINK_VARIANT null !!! ");
return;
}
type.setProperty(PROPS.LINK_VARIANT, variant.toString());
if (!CoreEngine.isArcaneVault()) {
XML_Writer.writeXML_ForType(type, isSkill() ? DC_TYPE.SKILLS : DC_TYPE.CLASSES);
}
LogMaster.log(1, type + "'s LINK_VARIANT set for " + variant);
rebuildAndSetTree();
}
use of eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT in project Eidolons by IDemiurge.
the class HT_MapBuilder method getShiftedLinkVariant.
public static LINK_VARIANT getShiftedLinkVariant(LINK_VARIANT variant, boolean moreVertical) {
if (variant == LINK_VARIANT.HORIZONTAL) {
if (moreVertical) {
return LINK_VARIANT.ANGLE_TO_LEFT;
}
return LINK_VARIANT.ANGLE_TO_RIGHT;
}
if (variant == LINK_VARIANT.VERTICAL) {
if (!moreVertical) {
return LINK_VARIANT.ANGLE_TO_LEFT;
}
return LINK_VARIANT.ANGLE_TO_RIGHT;
}
int i = new EnumMaster<LINK_VARIANT>().getEnumConstIndex(variant);
int n = moreVertical ? 1 : -1;
if (variant.isToRight()) {
i -= n;
} else if (variant.isToLeft()) {
i += n;
}
if (i < 0) {
if (!moreVertical) {
return LINK_VARIANT.HORIZONTAL;
}
}
if (i >= LINK_VARIANT.values().length) {
return null;
}
LINK_VARIANT link = LINK_VARIANT.values()[i];
// LINK_VARIANT.VERTICAL_LONG) {
if (!(link.isToRight() || link.isToLeft())) {
// preCheck LONG/s TODO
if (!moreVertical) {
return LINK_VARIANT.HORIZONTAL;
}
return LINK_VARIANT.VERTICAL;
}
return link;
}
use of eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT in project Eidolons by IDemiurge.
the class HT_MapBuilder method getNodePointFromLink.
private Point getNodePointFromLink(int parentX, ObjType type, int i, int sublingCount, ObjType parent, StaticTreeLink link) {
Point point;
LINK_VARIANT variant = link.getVariant();
point = link.getPoint();
Point originalPoint = new Point(point.x, point.y);
boolean adjusted = false;
if (isAutoAdjustmentOn()) {
if (parent != null) {
while (adjustLink(point, link, parent, type, parentX, i, sublingCount)) {
// link point or node point?
adjusted = true;
point = new PointX(link.getPoint().x + variant.getNodeOffsetX(), link.getPoint().y - // getPoint(link.getVariant(),
64);
// parent, type, parentX, i,
// sublingCount); //
// unnecessary?
}
}
}
if (adjusted) {
LogMaster.log(1, "^v^ " + type.getName() + " adjusted to " + variant + " from " + link.getVariant());
LogMaster.log(1, "^v^ " + type.getName() + " adjusted to " + point + " from " + originalPoint);
variant = link.getVariant();
map.getStaticLinkMap().put(link, getPoint(variant, parent, type, parentX, i, sublingCount));
}
// +getGroupNodeOffsetX(type,
int x = point.x + variant.getNodeOffsetX();
// link.getChildren());
if (!isAddLinkPerChild()) {
if (link.getVariant().isVertical() || (!link.isManualSet())) {
x = getX(parentX, i, sublingCount, type, parent);
}
}
// + variant.getNodeOffsetY();
int y = point.y - 64;
Point groupNodeOffset = groupNodePosMap.get(type);
if (groupNodeOffset != null) {
x += groupNodeOffset.x;
y += groupNodeOffset.y;
}
x += type.getIntParam(PARAMS.TREE_NODE_OFFSET_X);
y += type.getIntParam(PARAMS.TREE_NODE_OFFSET_Y);
int finalX = MathMaster.getMinMax(x, 0, defTreeWidth - 64);
int finalY = MathMaster.getMinMax(y, 0, defTreeHeight - 64);
// int diffY = finalY-y;
int abs = Math.abs(finalX - x);
if (!customPos) {
if (abs > 0) {
if (finalY == y) {
// just limit the diff!
LogMaster.log(1, type.getName() + " (x adjustment) -> Y decreased by " + abs);
// increase or decrease Y for x-change?
finalY += abs;
}
}
}
point = new PointX(finalX, finalY);
return point;
}
use of eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT in project Eidolons by IDemiurge.
the class HT_MapBuilder method addLink.
// private Point adjustPoint(Point point, StaticTreeLink link, ObjType
// parent, ObjType type,
// int parentX, int i, int sublingCount) {
// if (point.x > defTreeWidth - defSize || point.x < 0) {
// LINK_VARIANT variant = getMoreVertical(link.getVariant());
// getPoint(variant, parent, type, parentX, i, sublingCount);
// link.setVariant(variant);
// }
// if (point.y > defTreeHeight - defSize || point.y < 0) {
// }
// int yDiff;
// return point;
// }
protected void addLink(int parentX, ObjType type, int i, int sublingCount, ObjType parent) {
// }
if (parent == null) {
return;
}
LINK_VARIANT variant = getPresetLink(type);
if (!isAddLinkPerChild()) {
if (i > 0) {
if (variant == null) {
StaticTreeLink link = map.getLinkForParentType(parent, true);
link.getChildren().add(type);
// TODO add child!
return;
}
}
}
if (isGrouped(type, parent)) {
for (StaticTreeLink link : map.getStaticLinkMap().keySet()) {
// if (link.getSource() == parent) {
if (StringMaster.compareByChar(link.getChildren().get(0).getProperty(PROPS.TREE_NODE_GROUP), type.getProperty(PROPS.TREE_NODE_GROUP))) {
link.getChildren().add(type);
LogMaster.log(1, "Group Type added: " + "" + "" + type.getName() + " for " + link);
return;
}
}
if (variant == null) {
variant = getDefaultLinkVariant();
}
} else {
variant = getLinkVariant(type, i, sublingCount);
}
Point point = getPoint(variant, parent, type, parentX, i, sublingCount);
StaticTreeLink link = new StaticTreeLink(variant, point, parent, type);
if (getPresetLink(type) == variant) {
link.setManualSet(true);
}
map.getStaticLinkMap().put(link, point);
LogMaster.log(1, "LINK added: " + variant + " FOR " + type.getName() + " at " + point);
}
use of eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT in project Eidolons by IDemiurge.
the class HT_MapBuilder method addAltBaseLinks.
private void addAltBaseLinks() {
for (HT_Node c : map.getNodeMap().values()) {
String prop = c.getType().getProperty(PROPS.ALT_BASE_LINKS);
if (prop.isEmpty()) {
continue;
}
for (String s : StringMaster.open(prop)) {
String typeName = VariableManager.removeVarPart(s);
String vars = VariableManager.getVar(s);
LINK_VARIANT variant = new EnumMaster<LINK_VARIANT>().retrieveEnumConst(LINK_VARIANT.class, vars.split("=")[0]);
ObjType targetType = DataManager.getType(typeName, getTYPE());
Point point = map.getPointForType(c.getType());
// getPoint(variant, parent, type, parentX, i, sublingCount)
// point = getNodePointFromLink(point2.x, targetType, 0, 0,
// c.getType(), variant);
/*
* use the variant.getOffset()
*
* what point is base?
*
* c.
*
*/
int offsetX = StringMaster.getInteger(vars.split("=")[1].split(",")[0]);
int offsetY = StringMaster.getInteger(vars.split("=")[1].split(",")[1]);
point = new PointX(point.x + offsetX, point.y + offsetY);
StaticTreeLink link = new StaticTreeLink(variant, point, targetType, c.getType());
// link.setAlt(true); // what will it do?
map.getAltLinks().put(link, targetType);
}
}
}
Aggregations