コード例 #1
0
        public static ObjectDetectionZonesLayout loadObjectDetectionZoneLayout()
        {
            // filechooser
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.InitialDirectory = Directory.GetCurrentDirectory() + "\\" + ProjectConstants.OBJECTDETECTIONZONES_DIR;
            dlg.Filter = "ozone files (*.ozone)|*.ozone";
            dlg.FilterIndex = 2;
            dlg.RestoreDirectory = true;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                ObjectDetectionZonesLayout ret = null;
                bool isOkay = UtilitiesIO.GetObjectFromJson(ref ret, dlg.FileName);
                if (!isOkay)
                    return null;
                else
                    return ret;
            }

            return null;
        }
コード例 #2
0
        public void SetNewLayout(ObjectDetectionZonesLayout pLayout)
        {
            if (pLayout != null)
            {
                int highestID = 0;

                // workaround for databinding bug
                m_CurrentLayout.ObjectDetectionZones.Clear();
                foreach (ObjectDetectionZone z in pLayout.ObjectDetectionZones)
                {
                    m_CurrentLayout.ObjectDetectionZones.Add(z);

                    if (z.Id > highestID)
                    {
                        highestID = z.Id;
                    }
                }
                m_CurrentLayout.LayoutName = pLayout.LayoutName;

                m_IdCounter = highestID + 1;
            }
        }
コード例 #3
0
        public static void saveObjectDetectionZoneLayoutToFile(ObjectDetectionZonesLayout pCurrentLayout)
        {
            // check if scnes OBJECTDETECTIONZONES_DIR exists
            if (!Directory.Exists(ProjectConstants.OBJECTDETECTIONZONES_DIR))
            {
                Directory.CreateDirectory(ProjectConstants.OBJECTDETECTIONZONES_DIR);
            }

            System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
            dlg.InitialDirectory = Directory.GetCurrentDirectory() + "\\" + ProjectConstants.OBJECTDETECTIONZONES_DIR;
            dlg.Filter = "ozone files (*.ozone)|*.ozone";

            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            string filename = dlg.FileName;
            if (!filename.EndsWith(ProjectConstants.OBJECTDETECTIONZONES_FILE_ENDING))
            {
                filename = filename + ProjectConstants.OBJECTDETECTIONZONES_FILE_ENDING;
            }

            UtilitiesIO.SaveObjectToJson(pCurrentLayout, filename);
        }
コード例 #4
0
 /// <summary>
 /// constructor
 /// </summary>
 private ObjectDetectionManager()
 {
     m_CurrentLayout = new ObjectDetectionZonesLayout();
 }
コード例 #5
0
 internal void saveObjectDetectionZoneLayoutToFile()
 {
     ObjectDetectionZonesLayout.saveObjectDetectionZoneLayoutToFile(m_CurrentLayout);
 }
コード例 #6
0
 public void loadObjectDetectionZoneLayoutFromFile()
 {
     SetNewLayout(ObjectDetectionZonesLayout.loadObjectDetectionZoneLayout());
 }