예제 #1
0
 public VImageParseResultEntity(Position pos)
 {
     Pos = new VPosition(pos.X, pos.Y);
     Pos.EntityID = pos.EntityID;
     Pos.Radius = 3;
 }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="MhNr"></param>
        public void calcDMXRatios(int MhNr)
        {
            Log.Debug("calcDMXRatios");
            Log.DebugFormat("calcDMXRatios: MhNrSetupComplete.ContainsKey({0}: {1}", MhNr, MhNrSetupComplete.ContainsKey(MhNr));
            Log.DebugFormat("calcDMXRatios: MhNrSetupComplete[{0}]: {1}", MhNr, MhNrSetupComplete[MhNr]);
            Log.DebugFormat("calcDMXRatios: DMXSetupValues.ContainsKey: {0}", DMXSetupValues.ContainsKey(MhNr));
            if (MhNrSetupComplete.ContainsKey(MhNr) && MhNrSetupComplete[MhNr] && DMXSetupValues.ContainsKey(MhNr))
            {
                Log.DebugFormat("of moving head: {0}, Model.Map: {1}", MhNr, Model.Map);
                //calc epsilon = 5% of avg of height and with of map
                int epsilon = (int)Math.Round(((Model.Map.GetHeight() + Model.Map.GetWidth()) / 2) * 0.05);
                //get the relevant sample-points
                List<DMXImgSetupMappingValue> points = DMXSetupValues[MhNr];
                if (!MhNrIsVirtual[MhNr])
                {
                    //values in points.VirtualVal are currently image positions
                    //convert them into virtual positions
                    Log.Debug("calcDMXRatios: convert DMXSetupValues.VirtualVal from image to virtual positions");
                    List<DMXImgSetupMappingValue> virtualPoints = new List<DMXImgSetupMappingValue>();
                    DMXImgSetupMappingValue val = new DMXImgSetupMappingValue();
                    foreach (DMXImgSetupMappingValue entry in points)
                    {
                        VPosition pos = new VPosition(entry.VirtualVal.X, entry.VirtualVal.Y);
                        Log.DebugFormat("calcDMXRatios: image pos: {0}, {1}", pos.X, pos.Y);

                        Point virtualPos = getToPosition(pos);
                        Log.DebugFormat("calcDMXRatios: virtual pos: {0}, {1}", virtualPos.X, virtualPos.Y);

                        val.DMXImgVal = entry.DMXImgVal;
                        val.VirtualVal = virtualPos;
                        virtualPoints.Add(val);
                    }
                    DMXSetupValues[MhNr] = virtualPoints;
                    Log.DebugFormat("calcDMXRatios: DMXSetupValues[0].Count: {0}", DMXSetupValues[0].Count);
                    Log.DebugFormat("calcDMXRatios: DMXSetupValues[0][0].VirtualVal: {0}, {1}", DMXSetupValues[0][0].VirtualVal.X, DMXSetupValues[0][0].VirtualVal.Y);
                    MhNrIsVirtual[MhNr] = true;
                }
                Log.DebugFormat("calcDMXRatios: points.Count: {0}", points.Count);
                Tuple<ValueMapping, ValueMapping> valueMappings = null;
                //Tuple<ValueMapping, ValueMapping> valueMappings = calcRatios(epsilon, points);

                if (valueMappings != null)
                {
                    VirtualToDMXMapping[MhNr] = valueMappings.Item1;
                    Log.DebugFormat("calcDMXRatios: VirtualToDMXMapping.GetStartY.K: {0}", VirtualToDMXMapping[MhNr].GetStartY.K);
                    Log.DebugFormat("calcDMXRatios: VirtualToDMXMapping.GetStartY.D: {0}", VirtualToDMXMapping[MhNr].GetStartY.D);
                    DMXToVirtualMapping[MhNr] = valueMappings.Item2;
                    Log.DebugFormat("calcDMXRatios: DMXToVirtualMapping.GetStartY.K: {0}", DMXToVirtualMapping[MhNr].GetStartY.K);
                    Log.DebugFormat("calcDMXRatios: DMXToVirtualMapping.GetStartY.D: {0}", DMXToVirtualMapping[MhNr].GetStartY.D);
                }
                // else: Warning from DEBUG-mode is already logged!
            }
        }
예제 #3
0
 public VMovingHead()
 {
     Pos = new VPosition();
 }
예제 #4
0
 private Point getToPosition(VPosition pos)
 {
     // Calculate from picture pos to virtual pos
     Point imagePoint = new Point(pos.X, pos.Y);
     Point virtualPoint = ImgToVirtualMapping.calculate(imagePoint);
     return virtualPoint;
 }