Ejemplo n.º 1
0
        /// <summary>
        /// Inserts the information about the effort of the named edge valid from begin time to end time into the global edge weights container.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="effortValue"></param>
        /// <returns></returns>
        public TraCIResponse <object> SetEffort(string id, double beginTime, double endTime, double effortValue)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIDouble()
            {
                Value = beginTime
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = endTime
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = effortValue
            });

            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_EDGE_VARIABLE,
                       TraCIConstants.VAR_EDGE_EFFORT,
                       tmp
                       ));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the defined Polygon
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="color"></param>
        /// <param name="filled"></param>
        /// <param name="layer"></param>
        /// <param name="shape"></param>
        /// <returns></returns>
        public TraCIResponse <object> Add(string id, string name, Color color, bool filled, int layer, Polygon shape)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIString()
            {
                Value = name
            });
            tmp.Value.Add(color);
            tmp.Value.Add(new TraCIUByte()
            {
                Value = filled == false ? (byte)0: (byte)1
            });
            tmp.Value.Add(new TraCIInteger()
            {
                Value = layer
            });
            tmp.Value.Add(shape);

            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_POLYGON_VARIABLE,
                       TraCIConstants.ADD,
                       tmp
                       ));
        }
Ejemplo n.º 3
0
        // TODO: 'extended retrieval', see: http://sumo.dlr.de/wiki/TraCI/Edge_Value_Retrieval


        /// <summary>
        /// Inserts the information about the travel time of the named edge valid from begin time to end time into the global edge weights times container.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="travelTimeValue"></param>
        /// <returns></returns>
        public TraCIResponse <double> AdaptTraveltime(string id, int beginTime, int endTime, double travelTimeValue)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIInteger()
            {
                Value = beginTime
            });
            tmp.Value.Add(new TraCIInteger()
            {
                Value = endTime
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = travelTimeValue
            });

            return(TraCICommandHelper.ExecuteSetCommand <double, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_EDGE_VARIABLE,
                       TraCIConstants.VAR_EDGE_TRAVELTIME,
                       tmp
                       ));
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Appends a stage walking to the plan of the given person.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="edges"></param>
        /// <param name="arrivalPosition"></param>
        /// <param name="duration"></param>
        /// <param name="speed"></param>
        /// <param name="stopId"></param>
        /// <returns></returns>
        public TraCIResponse <object> AppendWalkingStage(string id, List <string> edges, double arrivalPosition, int duration, double speed, string stopId)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIInteger()
            {
                Value = 2
            });
            tmp.Value.Add(new TraCIStringList()
            {
                Value = edges
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = arrivalPosition
            });
            tmp.Value.Add(new TraCIString()
            {
                Value = stopId
            });
            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_PERSON_VARIABLE,
                       TraCIConstants.APPEND_STAGE,
                       tmp
                       ));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Appends a stage waiting to the plan of the given person.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="duration"></param>
        /// <param name="description"></param>
        /// <param name="stopId"></param>
        /// <returns></returns>
        public TraCIResponse <object> AppendWaitingStage(string id, int duration, string description, string stopId)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIInteger()
            {
                Value = 1
            });
            tmp.Value.Add(new TraCIInteger()
            {
                Value = duration
            });
            tmp.Value.Add(new TraCIString()
            {
                Value = description
            });
            tmp.Value.Add(new TraCIString()
            {
                Value = stopId
            });
            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_PERSON_VARIABLE,
                       TraCIConstants.APPEND_STAGE,
                       tmp
                       ));
        }
Ejemplo n.º 6
0
        // TODO: 'extended retrieval', see: http://sumo.dlr.de/wiki/TraCI/Person_Value_Retrieval

        /// <summary>
        ///     Inserts a new person to the simulation at the given edge, position and time (in s). This function should be followed by appending Stages or the person will immediately vanish on departure.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="typeId"></param>
        /// <param name="initialEdgeId"></param>
        /// <param name="departTime"></param>
        /// <param name="departPosition"></param>
        /// <returns></returns>
        public TraCIResponse <object> Add(string id, string typeId, string initialEdgeId, double departTime, double departPosition)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIString()
            {
                Value = typeId
            });
            tmp.Value.Add(new TraCIString()
            {
                Value = initialEdgeId
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = departTime
            });
            tmp.Value.Add(new TraCIDouble()
            {
                Value = departPosition
            });

            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_PERSON_VARIABLE,
                       TraCIConstants.ADD,
                       tmp
                       ));
        }
Ejemplo n.º 7
0
    public static CompoundObject MakeQuad(Transform parent, float size, string name = "")
    {
        GameObject go = new GameObject("Quad");

        if (name != "")
        {
            go.name = name;
        }
        go.transform.SetParent(parent);

        go.AddComponent <CompoundObject>();
        CompoundObject co = go.GetComponent <CompoundObject>();

        co.initialShape = InitialShape.Quad;

        co.primObjectList.Add(PrimitiveObject.MakeQuad(go.transform, size, new Vector3(0, 0, 0), PrimitiveObject.QuadOrientation.up));
        co.primObjectList.Add(PrimitiveObject.MakeQuad(go.transform, size, new Vector3(0, 0, 0), PrimitiveObject.QuadOrientation.down));

        return(co);
    }
Ejemplo n.º 8
0
        /// <summary>
        /// Adds the defined PoI
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="color"></param>
        /// <param name="layer"></param>
        /// <param name="position2D"></param>
        /// <returns></returns>
        public TraCIResponse <object> Add(string id, string name, Color color, int layer, Position2D position2D)
        {
            var tmp = new CompoundObject();

            tmp.Value.Add(new TraCIString()
            {
                Value = name
            });
            tmp.Value.Add(color);
            tmp.Value.Add(new TraCIInteger()
            {
                Value = layer
            });
            tmp.Value.Add(position2D);
            return(TraCICommandHelper.ExecuteSetCommand <object, CompoundObject>(
                       Client,
                       id,
                       TraCIConstants.CMD_SET_POI_VARIABLE,
                       TraCIConstants.ADD,
                       tmp
                       ));
        }
Ejemplo n.º 9
0
 public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, CompoundObject s)
     : base(_host, ctx, s)
 {
 }
Ejemplo n.º 10
0
 protected override string Generate_CompoundObject(IZetboxContext ctx, CompoundObject s)
 {
     return RunTemplateWithExtension(ctx, "Interfaces.Template", s.Module.Name, s.Name, "Designer.cs", s);
 }
Ejemplo n.º 11
0
        public static SingleValueFilterModel Create(IFrozenContext frozenCtx, string label, IFilterValueSource predicate, CompoundObject cpObj, ControlKind requestedKind, ControlKind requestedArgumentKind)
        {
            if (frozenCtx == null)
            {
                throw new ArgumentNullException("frozenCtx");
            }

            var fmdl = new SingleCompoundValueFilterModel()
            {
                Label                    = label,
                ValueSource              = predicate,
                Operator                 = FilterOperators.Equals,
                ViewModelType            = ViewModelDescriptors.Zetbox_Client_Presentables_FilterViewModels_SingleValueFilterViewModel.Find(frozenCtx),
                RequestedKind            = requestedKind,
                RefreshOnFilterChanged   = true,
                CompoundObjectDefinition = cpObj,
            };

            fmdl.FilterArguments.Add(new FilterArgumentConfig(
                                         new CompoundObjectValueModel(label, "", true, false, requestedArgumentKind, cpObj),
                                         cpObj.DefaultPropertyViewModelDescriptor ?? ViewModelDescriptors.Zetbox_Client_Presentables_ValueViewModels_CompoundObjectPropertyViewModel.Find(frozenCtx)));
            return(fmdl);
        }
Ejemplo n.º 12
0
    protected ModelerState DrawActions(ModelerState modelerState)
    {
        int layer_mask = LayerMask.GetMask("floor");
        Vector3 point = Vector3.zero;
        Ray rayInfo = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(rayInfo, out RaycastHit hitInfo, float.MaxValue, layerMask: layer_mask) == true) {
            point = hitInfo.point;
            point.y = 0;
        }

        switch (drawState) {
            case DrawState.isSettingUp:

                drawState = DrawState.isPlacing;
                break;

            case DrawState.isPlacing:

                UIManager.instance.ToolActions.ExtrudeToggleAction(false);

                if (Input.GetMouseButtonUp(0)) {
                    if (modelerState == ModelerState.DrawQuad) {
                        newCo = CompoundObject.MakeQuad(ModelParent, 2f);
                        newCo.transform.position = point;
                    } else if (modelerState == ModelerState.DrawCube) {
                        newCo = CompoundObject.MakeCube(ModelParent, 2f);
                        newCo.transform.position = point;
                    }
                    drawState = DrawState.isMoving;
                }

                break;
            case DrawState.isMoving:
                newCo.transform.position = point;

                if (Input.GetMouseButtonUp(0)) {
                    drawState = DrawState.isDrawing;
                }

                break;
            case DrawState.isDrawing:
                if (newCo != null) {
                    float magnitude = (Input.GetAxis("Mouse X") + Input.GetAxis("Mouse Y"));

                    UIManager.instance.InputPanel.SetMagnitudeFieldActive(true);
                    UIManager.instance.InputPanel.SetMagnitudeFieldText(newCo.Magnitute.ToString());

                    newCo.UpdateUniformlyCompoundbject(magnitude);
                }
                if (Input.GetMouseButtonUp(0)) {
                    UIManager.instance.InputPanel.SetAllActive(false);

                    newCo = null;

                    drawState = DrawState.isSettingUp;
                    return ModelerState.None;
                }

                return modelerState;

            default:
                break;
        }
        return modelerState;
    }
Ejemplo n.º 13
0
 public CompoundObject GetCurrentObject(CompoundObject parameter)
 {
     parameter.HashCdoe = parameter.GetHashCode();
     return(parameter);
 }
Ejemplo n.º 14
0
 public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, CompoundObject cType)
     : base(_host, ctx, cType)
 {
     this.CompoundObjectType = cType;
 }
Ejemplo n.º 15
0
 protected override string Generate_CompoundObject(IZetboxContext ctx, CompoundObject s)
 {
     return(RunTemplateWithExtension(ctx, "Interfaces.Template", s.Name, "Designer.cs", s));
 }
Ejemplo n.º 16
0
 protected virtual string Generate_CompoundObject(IZetboxContext ctx, CompoundObject s)
 {
     return(RunTemplateWithExtension(ctx, "CompoundObjects.Template", s.Name, "Designer.cs", s));
 }
Ejemplo n.º 17
0
 public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, CompoundObject cType)
     : base(_host, ctx, cType)
 {
     this.CompoundObjectType = cType;
 }
Ejemplo n.º 18
0
 public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, CompoundObject s)
     : base(_host, ctx, s)
 {
 }
Ejemplo n.º 19
0
 public CompoundObjectValueModel(string label, string description, bool allowNullInput, bool isReadOnly, CompoundObject def)
     : this(
         label,
         description,
         allowNullInput,
         isReadOnly,
         def.RequestedKind ?? (def.DefaultPropertyViewModelDescriptor != null ? def.DefaultPropertyViewModelDescriptor.DefaultEditorKind : null),
         def)
 {
 }
Ejemplo n.º 20
0
 protected virtual string Generate_CompoundObject(IZetboxContext ctx, CompoundObject s)
 {
     return RunTemplateWithExtension(ctx, "CompoundObjects.Template", s.Name, "Designer.cs", s);
 }
Ejemplo n.º 21
0
 public CompoundObjectValueModel(string label, string description, bool allowNullInput, bool isReadOnly, ControlKind requestedKind, CompoundObject def)
     : base(label, description, allowNullInput, isReadOnly, requestedKind)
 {
     this.CompoundObjectDefinition = def;
 }