Exemple #1
0
        private void FillLiensSupportFrom(IElementDeSchemaReseau element, List <CLienReseau> lstRetour, HashSet <int> setFaits, List <CLienReseau> lstSupports)
        {
            if (element == null)
            {
                return;
            }
            List <CLienReseau> lst = new List <CLienReseau>();

            foreach (CLienReseau lien in lstSupports)
            {
                if (!setFaits.Contains(lien.Id) && (lien.Element1 != null && lien.Element1.Equals(element) || lien.Element2 != null && lien.Element2.Equals(element)))
                {
                    lst.Add(lien);
                }
            }
            foreach (CLienReseau lien in lst)
            {
                setFaits.Add(lien.Id);
                lstRetour.Add(lien);
            }
            foreach (CLienReseau lien in lst)
            {
                FillLiensSupportFrom(lien.Element1.Id == element.Id?lien.Element2:lien.Element1, lstRetour, setFaits, lstSupports);
            }
        }
Exemple #2
0
        private void FillDicsForNode(CElementDeArbreOperationnel node,
                                     CDictionnaireElementToNoeudArbre dicEquipementToNoeudArbreOp,
                                     CDictionnaireElementToNoeudArbre dicSiteToNoeudArbreOp,
                                     CDictionnaireElementToNoeudArbre dicLiaisonToNoeudArbreOp,
                                     CDictionnaireElementToNoeudArbre dicServiceToNoeudArbreOp)
        {
            CElementDeArbreOperationnelEntite noeudEntite = node as CElementDeArbreOperationnelEntite;

            if (noeudEntite != null)
            {
                try
                {
                    IElementDeSchemaReseau eltAssocie = noeudEntite.Composant.GetElementAssocie(m_base.ContexteDonnee);

                    if (eltAssocie is CEquipementLogique)
                    {
                        CSpvEquip equipement = CSpvEquip.GetObjetSpvFromObjetTimos((CEquipementLogique)eltAssocie);
                        if (equipement != null)
                        {
                            dicEquipementToNoeudArbreOp.Add(equipement.Id, noeudEntite);
                        }
                    }
                    else if (eltAssocie is CSite)
                    {
                        CSpvSite site = CSpvSite.GetObjetSpvFromObjetTimos((CSite)eltAssocie);
                        if (site != null)
                        {
                            dicSiteToNoeudArbreOp.Add(site.Id, noeudEntite);
                        }
                    }
                    else if (eltAssocie is CLienReseau)
                    {
                        CSpvLiai liaison = CSpvLiai.GetObjetSpvFromObjetTimos((CLienReseau)eltAssocie);
                        if (liaison != null)
                        {
                            dicLiaisonToNoeudArbreOp.Add(liaison.Id, noeudEntite);
                        }
                    }
                    else if (eltAssocie is CSchemaReseau)
                    {
                        CSpvSchemaReseau schema = CSpvSchemaReseau.GetObjetSpvFromObjetTimos((CSchemaReseau)eltAssocie);
                        if (schema != null)
                        {
                            dicServiceToNoeudArbreOp.Add(schema.Id, noeudEntite);
                        }
                    }
                }
                catch { }
            }

            // Fonction récursive sur les noeuds fils
            foreach (CElementDeArbreOperationnel nodeFils in node.Fils)
            {
                FillDicsForNode(nodeFils,
                                dicEquipementToNoeudArbreOp,
                                dicSiteToNoeudArbreOp,
                                dicLiaisonToNoeudArbreOp,
                                dicServiceToNoeudArbreOp);
            }
        }
Exemple #3
0
        public IEnumerable <IElementDeSchemaReseau> GetSupportingElementsSortedFrom(IElementDeSchemaReseau element)
        {
            CListeObjetsDonnees           lstSupports = LiensSupportants;
            HashSet <int>                 setFaits    = new HashSet <int>();
            List <IElementDeSchemaReseau> lstElements = new List <IElementDeSchemaReseau>();

            if (element != null)
            {
                List <CLienReseau> lstLiens = new List <CLienReseau>();
                FillLiensSupportFrom(element, lstLiens, setFaits, lstSupports.ToList <CLienReseau>());
                lstElements.Add(element);
                foreach (CLienReseau lien in lstLiens)
                {
                    if (lien.Element1.Equals(element))
                    {
                        lstElements.Add(lien.Element2);
                    }
                    else
                    {
                        lstElements.Add(lien.Element1);
                    }
                }
            }
            return(lstElements);
        }
Exemple #4
0
        //------------------------------------------------------------
        public C2iObjetDeSchema GetObjetElement2(ref bool bCreate)
        {
            if (ElementDeSchema == null || !ElementDeSchema.IsValide())
            {
                return(null);
            }
            CLienReseau lien = ElementDeSchema.LienReseau;

            if (lien == null)
            {
                return(null);
            }
            IElementDeSchemaReseau extremite = null;
            CCheminLienReseau      racine    = ElementDeSchema.RacineChemin2;

            if (racine != null)
            {
                extremite = racine.Etape as IElementDeSchemaReseau;
            }
            if (extremite == null)
            {
                extremite = lien.Element2 as IElementDeSchemaReseau;
            }

            return(GetObjetElement(extremite, ref bCreate));
        }
Exemple #5
0
        //------------------------------------------------------------------------------------------
        public override I2iObjetGraphique GetCloneAMettreDansParent(I2iObjetGraphique parent, Dictionary <Type, object> dicObjetsPourCloner)
        {
            C2iObjetDeSchema parentAsC2iObjet = parent as C2iObjetDeSchema;

            if (m_elementAssocie != null && parentAsC2iObjet != null && parentAsC2iObjet.SchemaContenant != null)
            {
                IElementDeSchemaReseau eltDeSchema = (IElementDeSchemaReseau)m_elementAssocie.GetObjet(parentAsC2iObjet.SchemaContenant.ContexteDonnee);
                CElementDeSchemaReseau newElement  = new CElementDeSchemaReseau(eltDeSchema.ContexteDonnee);
                newElement.CreateNewInCurrentContexte();
                newElement.ElementAssocie = eltDeSchema;
                newElement.SchemaReseau   = parentAsC2iObjet.SchemaContenant;

                if (!m_bSizeIsSet)
                {
                    C2iSymbole symbole = eltDeSchema.SymboleADessiner;
                    if (symbole != null)
                    {
                        Size         = symbole.Size;
                        m_bSizeIsSet = true;
                    }
                }
                newElement.Width  = Size.Width;
                newElement.Height = Size.Height;

                C2iObjetDeSchema obj = eltDeSchema.GetObjetDeSchema(newElement);
                return(obj);
            }
            return(null);
        }
Exemple #6
0
 //------------------------------------------
 public void Draw(
     CContextDessinObjetGraphique ctx,
     IElementDeSchemaReseau element,
     C2iObjetGraphique objetGraphique)
 {
     ApplyOnSymbole(element);
     if (m_symbole != null)
     {
         m_symbole.Transparency = 100;
         Matrix oldMat = ctx.Graphic.Transform;
         C2iLienDeSchemaReseau lien = objetGraphique as C2iLienDeSchemaReseau;
         if (lien != null)
         {
             //Se place au centre du lien
             Point pt = lien.GetPointCentral();
             pt.Offset(-m_symbole.Width / 2, -m_symbole.Height / 2);
             ctx.Graphic.TranslateTransform(pt.X, pt.Y);
         }
         else
         {
             float fEchelleX = (float)objetGraphique.Size.Width / (float)m_symbole.Size.Width;
             float fEchelleY = (float)objetGraphique.Size.Height / (float)m_symbole.Size.Height;
             ctx.Graphic.InterpolationMode = InterpolationMode.HighQualityBilinear;
             ctx.Graphic.TranslateTransform(objetGraphique.Position.X, objetGraphique.Position.Y);
             ctx.Graphic.ScaleTransform(fEchelleX, fEchelleY);
         }
         m_symbole.Draw(ctx);
         ctx.Graphic.Transform = oldMat;
     }
 }
Exemple #7
0
        ///////////////////////////////////////////////////////////////
        protected override CResultAErreur MyFillFromElementDeGraphe(CElementDeArbreOperationnel element)
        {
            CResultAErreur result = CResultAErreur.True;
            CElementDeArbreOperationnelEntite eltComposant = element as CElementDeArbreOperationnelEntite;

            if (eltComposant == null)
            {
                result.EmpileErreur(I.T("Bad element type|20030"));
                return(result);
            }
            CComposantDeGrapheReseau composant = eltComposant.Composant;

            IElementDeSchemaReseau eltAssocie = composant.GetElementAssocie(ContexteDonnee);

            ElementAssocie = null;
            if (eltAssocie is CSite)
            {
                ElementAssocie = CSpvSite.GetObjetSpvFromObjetTimosAvecCreation(eltAssocie as CSite);
            }
            else if (eltAssocie is CEquipementLogique)
            {
                ElementAssocie = CSpvEquip.GetObjetSpvFromObjetTimosAvecCreation(eltAssocie as CEquipementLogique);
            }
            else if (eltAssocie is CLienReseau)
            {
                ElementAssocie = CSpvLiai.GetObjetSpvFromObjetTimosAvecCreation(eltAssocie as CLienReseau);
            }
            if (ElementAssocie == null)
            {
                result.EmpileErreur(I.T("Can not associate element to Graph component|20031"));
                return(result);
            }
            return(result);
        }
Exemple #8
0
        public IEnumerable <CLienReseau> GetSupportingSortedFrom(IElementDeSchemaReseau element)
        {
            CListeObjetsDonnees lstSupports = LiensSupportants;
            HashSet <int>       setFaits    = new HashSet <int>();
            List <CLienReseau>  lstLiens    = new List <CLienReseau>();

            FillLiensSupportFrom(element, lstLiens, setFaits, lstSupports.ToList <CLienReseau>());
            return(lstLiens.AsReadOnly());
        }
        public void InitFromSchema(CSchemaReseau schema)
        {
            m_dbKeySchemaReseau = schema.DbKey;
            m_schema            = schema;

            CListeObjetsDonnees lstElements = schema.ElementsDeSchema;

            lstElements.ReadDependances(
                "SchemaReseauInclu",
                "SchemaReseauContenu");

            foreach (CElementDeSchemaReseau elt in lstElements)
            {
                IElementDeSchemaReseau elementFils = elt.ElementAssocie;
                if (elementFils != null)
                {
                    CInfoElementDeSchemaSupervise fils = null;
                    if (elementFils is CSite)
                    {
                        fils = new CInfoSiteDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CLienReseau)
                    {
                        fils = new CInfoLienDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CElementDeSchemaReseau)
                    {
                        fils = new CInfoEquipementDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CSchemaReseau)
                    {
                        fils = new CInfoSchemaDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CEquipementLogique)
                    {
                        fils = new CInfoEquipementDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CEntiteSnmp)
                    {
                        fils = new CInfoEntiteSnmpDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils != null)
                    {
                        fils.InitFromElementDeSchema(elt);
                        m_listeFils.Add(fils);
                    }
                }
            }

            PrepareSupervisionEtatOperationnel(schema);
            CalculArbreOperationnel();
        }
Exemple #10
0
        /// <summary>
        /// Crée l'objet correspondant à l'une des extremités du lien
        /// </summary>
        private C2iObjetDeSchema CreateObjetFor(IElementDeSchemaReseau elementACreer)
        {
            CElementDeSchemaReseau eltDeSchema = new CElementDeSchemaReseau(ElementDeSchema.ContexteDonnee);

            eltDeSchema.CreateNewInCurrentContexte();
            eltDeSchema.SchemaReseau   = ElementDeSchema.SchemaReseau;
            eltDeSchema.ElementAssocie = elementACreer;
            C2iObjetDeSchema objetDeSchema = eltDeSchema.ObjetDeSchema;

            Parent.AddChild(objetDeSchema);
            objetDeSchema.Parent = Parent;
            return(objetDeSchema);
        }
Exemple #11
0
 public void InitFrom(IElementDeSchemaReseau element)
 {
     if (element != null)
     {
         m_elementAssocie = new CReferenceObjetDonnee((CObjetDonnee)element);
         C2iSymbole symbole = element.SymboleADessiner;
         if (symbole != null)
         {
             Size         = symbole.Size;
             m_bSizeIsSet = true;
         }
     }
 }
Exemple #12
0
        //-----------------------------
        public bool DrillDown(IElementDeSchemaReseau eltDeSchema)
        {
            CSchemaReseau schema = eltDeSchema as CSchemaReseau;

            if (schema == null)
            {
                CLienReseau lien = eltDeSchema as CLienReseau;
                if (lien != null)
                {
                    schema = lien.SchemaReseau;
                }
            }
            if (schema == null)
            {
                CSite site = eltDeSchema as CSite;
                if (site != null)
                {
                    //S'il y a un cablage, affiche le cablage
                    foreach (CSchemaReseau sousSchema in SchemaAffiche.SchemaFils)
                    {
                        if (site.Equals(sousSchema.SiteApparenance))
                        {
                            schema = sousSchema;
                            break;
                        }
                    }
                }
            }

            if (schema != null)
            {
                m_stackCheminsReseau.Push(schema);
                m_dessinDeSchema = schema.GetSchema(false);
                SetSelection(null);
                RedrawSchema();
                UpdateTraitementSNMP();
                if (OnChangeSchemaAffiche != null)
                {
                    OnChangeSchemaAffiche(this, new EventArgs());
                }
                SnmpUpdate();
                return(true);
            }
            return(false);
        }
Exemple #13
0
        //------------------------------------------
        protected void ApplyOnSymbole(IElementDeSchemaReseau elementRepresenté)
        {
            if (m_symbole == null)
            {
                return;
            }
            m_symbole.ElementASymbole = elementRepresenté;
            CContexteEvaluationExpression ctxEval = new CContexteEvaluationExpression(elementRepresenté);

            foreach (CParametreRepresentationElementDeSymbole parametre in Parametres)
            {
                C2iSymbole element = m_symbole.GetChildFromName(parametre.ElementName);
                if (element != null)
                {
                    parametre.ApplyOnElement(element, ctxEval);
                }
            }
        }
        private void FillDicsForNode(CElementDeArbreOperationnel node,
                                     CDictionnaireElementToNoeudArbre dicEquipementToNoeudArbreOp,
                                     CDictionnaireElementToNoeudArbre dicSiteToNoeudArbreOp,
                                     CDictionnaireElementToNoeudArbre dicLiaisonToNoeudArbreOp,
                                     CDictionnaireElementToNoeudArbre dicServiceToNoeudArbreOp)
        {
            CElementDeArbreOperationnelEntite noeudEntite = node as CElementDeArbreOperationnelEntite;

            if (noeudEntite != null)
            {
                try
                {
                    IElementDeSchemaReseau eltAssocie = noeudEntite.Composant.GetElementAssocie(m_base.ContexteDonnee);

                    if (eltAssocie is CEquipementLogique)
                    {
                        dicEquipementToNoeudArbreOp.Add(eltAssocie.DbKey, noeudEntite);
                    }
                    else if (eltAssocie is CSite)
                    {
                        dicSiteToNoeudArbreOp.Add(eltAssocie.DbKey, noeudEntite);
                    }
                    else if (eltAssocie is CLienReseau)
                    {
                        dicLiaisonToNoeudArbreOp.Add(eltAssocie.DbKey, noeudEntite);
                    }
                    else if (eltAssocie is CSchemaReseau)
                    {
                        dicServiceToNoeudArbreOp.Add(eltAssocie.DbKey, noeudEntite);
                    }
                }
                catch { }
            }

            // Fonction récursive sur les noeuds fils
            foreach (CElementDeArbreOperationnel nodeFils in node.Fils)
            {
                FillDicsForNode(nodeFils,
                                dicEquipementToNoeudArbreOp,
                                dicSiteToNoeudArbreOp,
                                dicLiaisonToNoeudArbreOp,
                                dicServiceToNoeudArbreOp);
            }
        }
Exemple #15
0
        //-----------------------------
        private void m_panelDessin_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            List <C2iObjetDeSchema> lst = GetObjetsFromPoint(new Point(e.X, e.Y));

            if (lst.Count > 0)
            {
                foreach (C2iObjetDeSchema objetDeSchema in lst)
                {
                    CElementDeSchemaReseau elementDeSchema = objetDeSchema.ElementDeSchema;
                    if (elementDeSchema != null)
                    {
                        IElementDeSchemaReseau elt = elementDeSchema.ElementAssocie;
                        if (DrillDown(elt))
                        {
                            return;
                        }
                    }
                }
            }
        }
Exemple #16
0
 private void m_menuRightClick_Opening(object sender, CancelEventArgs e)
 {
     m_menuAlarmes.Visible        = false;
     m_menuShowDiagram.Visible    = false;
     m_menuShowProperties.Visible = false;
     if (m_objetDeSchemaSelectionne != null)
     {
         CElementDeSchemaReseau eltDeSchema = m_objetDeSchemaSelectionne.ElementDeSchema;
         if (eltDeSchema != null)
         {
             IElementDeSchemaReseau elt = eltDeSchema.ElementAssocie;
             if (elt != null)
             {
                 m_menuShowProperties.Visible = true;
             }
             m_menuAlarmes.DropDownItems.Clear();
             if (elt is CSchemaReseau || elt is CLienReseau)
             {
                 m_menuShowDiagram.Visible = true;
             }
             List <CLocalAlarme> lstAlarmes = m_baseVue.GetAlarmesPourElement(eltDeSchema);
             if (lstAlarmes.Count == 0)
             {
                 m_menuAlarmes.Visible = false;
             }
             else
             {
                 lstAlarmes.Sort(new CSorterAlarmes());
                 foreach (CLocalAlarme alarme in lstAlarmes)
                 {
                     CMenuItemAvecAlarme menu = new CMenuItemAvecAlarme(alarme);
                     menu.Click += new EventHandler(menu_Click);
                     m_menuAlarmes.DropDownItems.Add(menu);
                 }
                 m_menuAlarmes.Visible = true;
             }
         }
     }
 }
Exemple #17
0
        //------------------------------------------------------------
        protected C2iObjetDeSchema GetObjetElement(IElementDeSchemaReseau elt, ref bool bCreate)
        {
            bool bAutoriseCreate = bCreate;

            bCreate = false;
            if (elt == null)
            {
                return(null);
            }
            C2iObjetDeSchema objetParent = Parent as C2iObjetDeSchema;

            if (objetParent == null)
            {
                return(null);
            }
            while ((objetParent.Parent as C2iObjetDeSchema) != null)
            {
                objetParent = objetParent.Parent as C2iObjetDeSchema;
            }
            C2iObjetDeSchema objetElement = objetParent.FindChildRepresentant(elt);

            if (objetElement != null)
            {
                return(objetElement);
            }
            if (bAutoriseCreate)
            {
                C2iObjetDeSchema objet = CreateObjetFor(elt);
                if (objet == null)
                {
                    return(null);
                }
                objet.Position = new Point(Position.X - objet.Size.Width / 2,
                                           Position.Y - objet.Size.Height / 2);
                bCreate = true;
                return(objet);
            }
            return(null);
        }
Exemple #18
0
        /// <summary>
        /// Sélectionne une extremité pour l'objet de schéma demandé.
        /// </summary>
        /// <param name="objetDeSchema"></param>
        /// <returns></returns>
        public static IElementALiensReseau SelectExtremite(IElementDeSchemaReseau eltDeSchema, ref IEtapeLienReseau[] etapes)
        {
            if (eltDeSchema == null)
            {
                return(null);
            }
            IEtapeLienReseau     etape    = eltDeSchema as IEtapeLienReseau;
            IElementALiensReseau eltALien = eltDeSchema as IElementALiensReseau;

            if (etape == null)
            {
                return(eltALien);
            }
            IElementALiensReseau[] elementsPossibles = etape.ElementsALiensContenus;
            IEtapeLienReseau[]     etapesPossibles   = etape.EtapesContenues;
            if (elementsPossibles.Length == 0 && etapesPossibles.Length == 0)
            {
                return(eltALien);
            }
            if (eltALien == null && elementsPossibles.Length == 1 && etapesPossibles.Length == 0)
            {
                etapes = new IEtapeLienReseau[] { etape };
                return(elementsPossibles[0]);
            }
            CFormSelectExtremiteDeElementDeSchema form = new CFormSelectExtremiteDeElementDeSchema();

            form.m_elementDeSchemaRacine = eltDeSchema;
            eltALien      = null;
            form.Location = Cursor.Position;
            if (form.ShowDialog() == DialogResult.OK)
            {
                eltALien = form.m_elementSelectionne;
                etapes   = form.m_etapes;
            }
            form.Dispose();
            return(eltALien);
        }
Exemple #19
0
        public bool AfterDrawElement(CContextDessinObjetGraphique ctx, C2iObjetGraphique objetGraphique)
        {
            C2iObjetDeSchema objetDessine = objetGraphique as C2iObjetDeSchema;

            if (objetDessine == null || objetDessine.ElementDeSchema == null)
            {
                return(true);
            }
            IElementDeSchemaReseau elementDeSchema = objetDessine.ElementDeSchema.ElementAssocie;

            if (elementDeSchema == null)
            {
                return(true);
            }
            Type tp = elementDeSchema.GetType();
            CParametreRepresentationSymbole parametre = this[tp];

            if (parametre == null)
            {
                return(true);
            }
            parametre.Draw(ctx, elementDeSchema, objetGraphique);
            return(true);
        }
Exemple #20
0
 //---------------------------------------------------
 /// <summary>
 /// Recherche l'objet représentant un objet spécifique dans le schéma
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 public C2iObjetDeSchema FindChildRepresentant(IElementDeSchemaReseau element)
 {
     if (element == null)
     {
         return(null);
     }
     foreach (C2iObjetDeSchema objet in Childs)
     {
         if (objet.ElementDeSchema != null && objet.ElementDeSchema.IsValide() && element.Equals(objet.ElementDeSchema.ElementAssocie))
         {
             return(objet);
         }
     }
     //Si pas trouvé dans les fils, cherche dans les fils des fils
     foreach (C2iObjetDeSchema objet in Childs)
     {
         C2iObjetDeSchema objetDansFils = objet.FindChildRepresentant(element);
         if (objetDansFils != null)
         {
             return(objetDansFils);
         }
     }
     return(null);
 }
        //---------------------------------------------------------------------
        private DragDropEffects m_arbreConsultation_OnDragNode(object sender, CNodeConsultationHierarchique node)
        {
            //if (m_gestionnaireModeEdition.ModeEdition)
            {
                IElementDeSchemaReseau element = node.ObjetLie as IElementDeSchemaReseau;



                if (element != null && m_schemaReseau != null)
                {
                    if (m_lienEdite != null)
                    {
                        if (element.GetType() == typeof(CLienReseau))
                        {
                            CLienReseau lien = (CLienReseau)element;

                            if (!m_lienEdite.PeutEtreSupporte(lien))
                            {
                                CFormAlerte.Afficher(I.T("Cannot add the link because it is already supported by the current link|30385"), EFormAlerteType.Erreur);
                                return(DragDropEffects.None);
                            }


                            if (!m_lienEdite.TypeSupportantPossible(lien))
                            {
                                CFormAlerte.Afficher(I.T("Cannot add the link because its type is not a possible supporting type for this link type|30400"), EFormAlerteType.Erreur);
                                return(DragDropEffects.None);
                            }
                        }
                    }

                    if (element.GetType() == typeof(CSchemaReseau))
                    {
                        //CSchemaReseau schema = (CSchemaReseau)element;

                        //if (schema.SchemaParent != null)
                        //{
                        //    CFormAlerte.Afficher(I.T("Cannot add the diagram beacuse it is included in another diagram|30391"),EFormAlerteType.Erreur);
                        //    return DragDropEffects.None;
                        //}
                    }


                    /*CElementDeSchemaReseau elementDeSchema = new CElementDeSchemaReseau(m_schemaReseau.ContexteDonnee);
                     * elementDeSchema.CreateNewInCurrentContexte();
                     * elementDeSchema.ElementAssocie = element;
                     * elementDeSchema.SchemaReseau = m_schemaReseau;*/

                    C2iObjetDeSchemaTemporairePourDragDropSansElementDeSchema objet = new C2iObjetDeSchemaTemporairePourDragDropSansElementDeSchema();
                    objet.InitFrom(element);

                    CDonneeDragDropObjetGraphique data = new CDonneeDragDropObjetGraphique(m_arbreConsultation.GetType().ToString(), objet);
                    DataObject dataObj = new DataObject();
                    dataObj.SetData(data);
                    dataObj.SetData(typeof(CReferenceObjetDonnee), new CReferenceObjetDonnee((CObjetDonnee)element));
                    DragDropEffects eff = DoDragDrop(dataObj, DragDropEffects.All | DragDropEffects.Link);

                    /* if (eff == DragDropEffects.None)
                     *   elementDeSchema.CancelCreate();*/
                }
            }
            return(DragDropEffects.None);
        }
Exemple #22
0
        public void InitFromSchema(CSchemaReseau schema)
        {
            m_nIdSchemaReseau = schema.Id;
            m_schema          = schema;

            CSpvSchemaReseau schemaSPV = CSpvSchemaReseau.GetObjetSpvFromObjetTimos(schema);

            if (schemaSPV != null)
            {
                m_nIdSchemaReseauSpv = schemaSPV.Id;
            }

            CListeObjetsDonnees lstElements = schema.ElementsDeSchema;

            lstElements.ReadDependances(
                "SchemaReseauInclu",
                "SchemaReseauContenu");
            //Charge les données SPV
            AssureRelationsToSpv();
            CListeObjetsDonnees lstTmp = lstElements.GetDependances("Site");

            lstTmp.GetDependances(m_relationFromSiteSpvToSite).AssureLectureFaite();

            lstTmp = lstElements.GetDependances("EquipementLogique");
            lstTmp.GetDependances(m_relationFromEquipementSpvToEquipement).AssureLectureFaite();

            lstTmp = lstElements.GetDependances("LienReseau");
            lstTmp.GetDependances(m_relationFromLiaisonSpvToLiaison).AssureLectureFaite();

            //CSpvService service = CSpvService.GetObjetSpvFromObjetTimos(schema);

            foreach (CElementDeSchemaReseau elt in lstElements)
            {
                IElementDeSchemaReseau elementFils = elt.ElementAssocie;
                if (elementFils != null)
                {
                    CInfoElementDeSchemaSupervise fils = null;
                    if (elementFils is CSite)
                    {
                        fils = new CInfoSiteDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CLienReseau)
                    {
                        fils = new CInfoLienDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CElementDeSchemaReseau)
                    {
                        fils = new CInfoEquipementDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CSchemaReseau)
                    {
                        fils = new CInfoSchemaDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils is CEquipementLogique)
                    {
                        fils = new CInfoEquipementDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1);
                    }
                    if (elementFils != null)
                    {
                        fils.InitFromElementDeSchema(elt);
                        m_listeFils.Add(fils);
                    }
                }
            }

            PrepareSupervisionEtatOperationnel(schema);
            CalculArbreOperationnel();
        }