Package wecui.event.cui

Source Code of wecui.event.cui.CUISelectionEvent

package wecui.event.cui;

import wecui.WorldEditCUI;
import wecui.render.region.BaseRegion;
import wecui.render.region.CuboidRegion;
import wecui.render.region.CylinderRegion;
import wecui.render.region.EllipsoidRegion;
import wecui.render.region.PolygonRegion;

/**
* Called when selection event is received
*
* @author lahwran
* @author yetanotherx
*/
public class CUISelectionEvent extends CUIBaseEvent {

    public CUISelectionEvent(WorldEditCUI controller, String[] args) {
        super(controller, args);
    }

    @Override
    public CUIEventType getEventType() {
        return CUIEventType.SELECTION;
    }

    @Override
    public String run() {

        BaseRegion newRegion = null;

        if (this.getString(0).equals("cuboid")) {
            newRegion = new CuboidRegion(controller);
        } else if (this.getString(0).equals("polygon2d")) {
            newRegion = new PolygonRegion(controller);
        } else if (this.getString(0).equals("ellipsoid")) {
            newRegion = new EllipsoidRegion(controller);
        } else if (this.getString(0).equals("cylinder")) {
            newRegion = new CylinderRegion(controller);
        } else {
            return "Invalid selection type. Must be cuboid|polygon2d|ellipsoid|cylinder.";
        }

        controller.setSelection(newRegion);
        controller.getDebugger().debug("Received selection event, initalizing new region instance.");

        return null;
    }
}
TOP

Related Classes of wecui.event.cui.CUISelectionEvent

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.