Beispiel #1
0
        /// <summary>
        /// Call once to load the static definitions, which are contained in the resources.
        /// </summary>
        public void LoadStatic(MtpSymbolLib syms)
        {
            // add elements
            records.Add(new MtpVisualObjectRecord("Pressurized_vessel_horizontal",
                                                  syms["PNID_ISO10628.Pressurized_vessel_horizontal"],
                                                  eClassVersions: "10.1", eClassClasses: "99999999", prio: 0));

            records.Add(new MtpVisualObjectRecord("Pressurized_vessel_vertical",
                                                  syms["PNID_ISO10628.Pressurized_vessel_vertical"],
                                                  eClassClasses: "36020190;36030101", prio: 0));

            records.Add(new MtpVisualObjectRecord("Shutoff_Valve",
                                                  syms["PNID_ISO10628.Shutoff_Valve_nozzled"],
                                                  eClassVersions: "10.1", eClassClasses: "37010201",
                                                  placement: MtpSymbol.SymbolPlaceType.FitNozzles, prio: 0));

            //// records.Add(new MtpVisualObjectRecord("Pump_general",
            ////    syms["PNID_ISO10628.Pump_general_nozzled"],
            ////    eClassClasses: "36419090;3641", placement: MtpSymbol.SymbolPlaceType.FitNozzles, prio: 0));

            records.Add(new MtpVisualObjectRecord("Sensor_general",
                                                  syms["PNID_ISO10628.Sensor_general"],
                                                  eClassClasses: "27209090;27143121;27200492;27200600;27200200;27200589", prio: 0));

            records.Add(new MtpVisualObjectRecord("Controller_general",
                                                  syms["PNID_ISO10628.Sensor_general"],
                                                  eClassClasses: "27210790;27210101", prio: 0));

            records.Add(new MtpVisualObjectRecord("Source_general",
                                                  syms["PNID_ISO10628.Source_tagged"],
                                                  placement: MtpSymbol.SymbolPlaceType.FitNozzles,
                                                  labelAlignment: UIElementHelper.DrawToCanvasAlignment.North, prio: 0));

            records.Add(new MtpVisualObjectRecord("Sink_general",
                                                  syms["PNID_ISO10628.Sink_tagged"],
                                                  placement: MtpSymbol.SymbolPlaceType.FitNozzles,
                                                  labelAlignment: UIElementHelper.DrawToCanvasAlignment.South, prio: 0));

            // access resource dictionaries FESTO

            records.Add(new MtpVisualObjectRecord("Control_Valve",
                                                  syms["PNID_Festo.control_valve_tagged-u-nozzled"],
                                                  eClassClasses: "37010203", placement: MtpSymbol.SymbolPlaceType.FitNozzles, prio: 0));

            records.Add(new MtpVisualObjectRecord("Manual_Valve",
                                                  syms["PNID_Festo.manual_valve_default-u-nozzled"],
                                                  eClassClasses: "37010201", placement: MtpSymbol.SymbolPlaceType.FitNozzles, prio: 0));

            records.Add(new MtpVisualObjectRecord("Stirrer",
                                                  syms["PNID_Festo.stirrer_active-u"],
                                                  eClassClasses: "36090590", placement: MtpSymbol.SymbolPlaceType.StretchToBoundingBox, prio: 0));

            records.Add(new MtpVisualObjectRecord("Pump_general",
                                                  syms["PNID_Festo.pump_active-r-nozzled"],
                                                  eClassClasses: "36419090;3641", placement: MtpSymbol.SymbolPlaceType.FitNozzles, prio: 0));
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // start
            SetMessage("Application started.");

            // initialize symbol library
            this.theSymbolLib = new MtpSymbolLib();

            var ISO10628 = new ResourceDictionary();

            ISO10628.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_DIN_EN_ISO_10628.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_ISO10628", ISO10628);

            var FESTO = new ResourceDictionary();

            FESTO.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_Festo.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_Festo", FESTO);

            // initialize visual object libraries
            activeVisualObjectLib = new WpfMtpControl.MtpVisualObjectLib();
            activeVisualObjectLib.LoadStatic(this.theSymbolLib);

            // to find options
            this.theOptions = AasxPluginOptionsBase.LoadDefaultOptionsFromAssemblyDir <MtpViewerStandaloneOptions>(
                "WpfMtpVisuViewer", Assembly.GetExecutingAssembly());
            if (this.theOptions != null && this.theOptions.SymbolMappings != null)
            {
                activeVisualObjectLib.LoadFromSymbolMappings(this.theSymbolLib, this.theOptions.SymbolMappings);
                SetMessage("Options loaded.");
            }

            // load file
            try
            {
                //// LoadFile("Dosing.mtp");
                //// LoadFile("Manifest_PxC_Dosing.aml");
                LoadFile("Manifest_V18.10.31_3_better_name_win3.aml");
                //// LoadFile("Manifest_Sten1.aml");
                //// LoadFile("Manifest_ChemiReaktor_MIHO.aml");

                SetMessage("MTP file loaded.");
            }
            catch (Exception ex)
            {
                SetMessage("Exception: {0}", ex.Message);
            }

            // fit it
            this.mtpVisu.ZoomToFitCanvas();

            // double click handler
            this.mtpVisu.MtpObjectDoubleClick += MtpVisu_MtpObjectDoubleClick;
        }
Beispiel #3
0
        public void LoadFromSymbolMappings(MtpSymbolLib symbolLib, IEnumerable <MtpSymbolMapRecord> mappings)
        {
            // access
            if (symbolLib == null | mappings == null)
            {
                return;
            }

            // each ..
            foreach (var map in mappings)
            {
                records.Add(new MtpVisualObjectRecord(symbolLib, map));
            }
        }
Beispiel #4
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            // initialize symbol library
            this.theSymbolLib = new MtpSymbolLib();

            var ISO10628 = new ResourceDictionary();

            ISO10628.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_DIN_EN_ISO_10628.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_ISO10628", ISO10628);

            var FESTO = new ResourceDictionary();

            FESTO.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_Festo.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_Festo", FESTO);

            // initialize visual object libraries
            activeVisualObjectLib = new WpfMtpControl.MtpVisualObjectLib();
            activeVisualObjectLib.LoadStatic(this.theSymbolLib);

            // gather infos
            var ok = GatherMtpInfos(this.thePreLoadInfo);

            if (ok && this.activeMtpFileFn != null)
            {
                // access file
                var inputFn = this.activeMtpFileFn;
                if (CheckIfPackageFile(inputFn))
                {
                    inputFn = thePackage.MakePackageFileAvailableAsTempFile(inputFn);
                }

                // load file
                LoadFile(inputFn);

                // fit it
                this.mtpVisu.ZoomToFitCanvas();

                // double click handler
                this.mtpVisu.MtpObjectDoubleClick += MtpVisu_MtpObjectDoubleClick;
            }

            // Timer for status
            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            // ReSharper disable once RedundantDelegateCreation
            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            dispatcherTimer.Start();
        }
Beispiel #5
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            // initialize symbol library
            this.theSymbolLib = new MtpSymbolLib();

            var ISO10628 = new ResourceDictionary();

            ISO10628.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_DIN_EN_ISO_10628.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_ISO10628", ISO10628);

            var FESTO = new ResourceDictionary();

            FESTO.Source = new Uri(
                "pack://application:,,,/WpfMtpControl;component/Resources/PNID_Festo.xaml");
            this.theSymbolLib.ImportResourceDicrectory("PNID_Festo", FESTO);

            // initialize visual object libraries
            activeVisualObjectLib = new WpfMtpControl.MtpVisualObjectLib();
            activeVisualObjectLib.LoadStatic(this.theSymbolLib);

            // gather infos
            var ok = GatherMtpInfos();

            if (ok && this.activeMtpFileFn != null)
            {
                // access file
                var inputFn = this.activeMtpFileFn;
                if (CheckIfPackageFile(inputFn))
                {
                    inputFn = thePackage.MakePackageFileAvailableAsTempFile(inputFn);
                }

                // load file
                LoadFile(inputFn);

                // fit it
                this.mtpVisu.ZoomToFitCanvas();

                // double click handler
                this.mtpVisu.MtpObjectDoubleClick += MtpVisu_MtpObjectDoubleClick;
            }
        }
Beispiel #6
0
        public MtpVisualObjectRecord(MtpSymbolLib symbolLib, MtpSymbolMapRecord config)
        {
            if (config != null)
            {
                this.Name           = config.SymbolDefault;
                this.eClassVersions = PrepDict(config.EClassVersions);
                this.eClassClasses  = PrepDict(config.EClassClasses);
                this.eClassIRDIs    = PrepDict(config.EClassIRDIs);

                if (symbolLib != null && symbolLib.ContainsKey(config.SymbolDefault))
                {
                    var symbol = symbolLib[config.SymbolDefault];
                    this.Symbol         = symbol;
                    this.Placement      = symbol.PreferredPlacement;
                    this.LabelAlignment = symbol.PreferredLabelAlignment;
                }

                this.Priority = config.Priority;
            }
        }