public override void FillDicsElementToNoeudsArbre( CDictionnaireElementToNoeudArbre dicEquipementToNoeudArbreOp, CDictionnaireElementToNoeudArbre dicSiteToNoeudArbreOp, CDictionnaireElementToNoeudArbre dicLiaisonToNoeudArbreOp, CDictionnaireElementToNoeudArbre dicServiceToNoeudArbreOp) { base.FillDicsElementToNoeudsArbre( dicEquipementToNoeudArbreOp, dicSiteToNoeudArbreOp, dicLiaisonToNoeudArbreOp, dicServiceToNoeudArbreOp); // Rempli les dictionnaires : Id élement -> liste de noeuds // Sens aller CElementDeArbreOperationnel noeudRacineA = m_arbreAller.ElementRacine; FillDicsForNode(noeudRacineA, dicEquipementToNoeudArbreOp, dicSiteToNoeudArbreOp, dicLiaisonToNoeudArbreOp, dicServiceToNoeudArbreOp); // Sens Retour CElementDeArbreOperationnel noeudRacineR = m_arbreRetour.ElementRacine; FillDicsForNode(noeudRacineR, dicEquipementToNoeudArbreOp, dicSiteToNoeudArbreOp, dicLiaisonToNoeudArbreOp, dicServiceToNoeudArbreOp); }
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); } }
/////////////////////////////////////////////////////////////// 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); }
private void CreateNode(CElementDeArbreOperationnel element, TreeNodeCollection nodes) { TreeNode node = new TreeNode(); FillNode(node, element); nodes.Add(node); foreach (CElementDeArbreOperationnel elt in element.Fils) { CreateNode(elt, node.Nodes); } }
private void FillNode(TreeNode node, CElementDeArbreOperationnel element) { string strText = element.ToString().Split('\n')[0] + " "; if (element.ElementParent != null) { strText += "(" + element.ElementParent.ToString().Split('\n')[0] + ")"; } strText += (element.CoeffOperationnel).ToString("0.##%"); node.Text = strText; node.Tag = element; }
private void AfficheNode(TreeNode node) { CElementDeArbreOperationnel elt = node.Tag as CElementDeArbreOperationnel; if (elt == null) { m_panelDroite.Visible = false; return; } m_panelDroite.Visible = true; m_lblNode.Text = elt.ToString(); m_txtCoeff.DoubleValue = elt.CoeffOperationnel; m_nodeAffiche = node; }
private void ChangeCoefOperationnel(TreeNode node, double value) { CElementDeArbreOperationnel elt = node.Tag as CElementDeArbreOperationnel; if (elt != null) { elt.SetCoeffOperationnel(value); } if (elt.ElementParent != null) { elt.ElementParent.RecalculeCoefOperationnelFromChilds(); } while (node != null) { FillNode(node, node.Tag as CElementDeArbreOperationnel); node = node.Parent; } }
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); } }
private void PropageCoefOperationnel(List <CElementDeArbreOperationnel> listeNoeudsConcernes, double fCoef) { // Passe tous les coef opérationnels à 0 = HS if (listeNoeudsConcernes != null) { foreach (CElementDeArbreOperationnel node in listeNoeudsConcernes) { node.SetCoeffOperationnel(fCoef); node.RecalculeCoefOperationnelFromChilds(); CElementDeArbreOperationnel nodeParent = node; while (nodeParent.ElementParent != null) { nodeParent = nodeParent.ElementParent; } CInfoElementDeSchemaSupervise info = null; if (m_dicNoeudArbreRacineToInfoElement.TryGetValue(nodeParent, out info)) { if (info is CInfoEquipementDeSchemaSupervise) { m_dicEquipementToNoeudArbreOp.TryGetValue(((CInfoEquipementDeSchemaSupervise)info).IdEquipementSpv.Value, out listeNoeudsConcernes); } else if (info is CInfoSiteDeSchemaSupervise) { m_dicSiteToNoeudArbreOp.TryGetValue(((CInfoSiteDeSchemaSupervise)info).IdSiteSpv.Value, out listeNoeudsConcernes); } else if (info is CInfoLienDeSchemaSupervise) { m_dicLiaisonToNoeudArbreOp.TryGetValue(((CInfoLienDeSchemaSupervise)info).IdLienSpv.Value, out listeNoeudsConcernes); } else if (info is CInfoSchemaDeSchemaSupervise) { m_dicServiceToNoeudArbreOp.TryGetValue(((CInfoSchemaDeSchemaSupervise)info).IdSchemaSpv, out listeNoeudsConcernes); } if (listeNoeudsConcernes != null) { PropageCoefOperationnel(listeNoeudsConcernes, fCoef); } } } } }
/////////////////////////////////////////////////////////////// public virtual CResultAErreur FillFromElementDeGraphe(CElementDeArbreOperationnel elementSource) { CResultAErreur result = MyFillFromElementDeGraphe(elementSource); foreach (CElementDeArbreOperationnel child in elementSource.Fils) { result = CreateFromElementDeArbreOperationnel(SpvSchema, child, SensGraphe); if (result) { CSpvElementDeGraphe elt = result.Data as CSpvElementDeGraphe; elt.ElementParent = this; } else { return(result); } } return(result); }
//----------------------------------------------------------- protected override CResultAErreur MyFillFromElementDeGraphe(CElementDeArbreOperationnel element) { CResultAErreur result = CResultAErreur.True; CElementDeArbreOperationnelSousSchema eltSousSchema = element as CElementDeArbreOperationnelSousSchema; if (eltSousSchema == null) { result.EmpileErreur(I.T("Bad element type|20030")); return(result); } CSchemaReseau schema = new CSchemaReseau(ContexteDonnee); if (!schema.ReadIfExists(eltSousSchema.IdSchema)) { result.EmpileErreur(I.T("Can not find schema @1|20032", eltSousSchema.IdSchema.ToString())); return(result); } SmtSchema = schema; _sys_CleNoeudArrivee = GetKeyNoeud(eltSousSchema.NoeudArrive); _sys_CleNoeudDepart = GetKeyNoeud(eltSousSchema.NoeudDepart); return(result); }
/////////////////////////////////////////////////////////////// /// <summary> /// Le data du result contient l'élément créé /// </summary> /// <param name="spvSchema"></param> /// <param name="elementSource"></param> /// <returns></returns> public static CResultAErreur CreateFromElementDeArbreOperationnel( CSpvSchemaReseau spvSchema, CElementDeArbreOperationnel elementSource, ESensAllerRetourLienReseau?sens) { CResultAErreur result = CResultAErreur.True; CSpvElementDeGraphe newElt = null; if (elementSource is CElementDeArbreOperationnelOperateurEt) { newElt = new CSpvElementDeGrapheOperateurEt(spvSchema.ContexteDonnee); } if (elementSource is CElementDeArbreOperationnelOperateurOu) { newElt = new CSpvElementDeGrapheOperateurOu(spvSchema.ContexteDonnee); } if (elementSource is CElementDeArbreOperationnelSousSchema) { newElt = new CSpvElementDeGrapheSousSchema(spvSchema.ContexteDonnee); } if (elementSource is CElementDeArbreOperationnelEntite) { newElt = new CSpvElementDeGrapheElementDeSchema(spvSchema.ContexteDonnee); } newElt.CreateNewInCurrentContexte(); newElt.SpvSchema = spvSchema; newElt.SensGraphe = sens; newElt.CoefficientOperationnel = elementSource.CoeffOperationnel; result = newElt.FillFromElementDeGraphe(elementSource); if (!result) { return(result); } result.Data = newElt; return(result); }
/////////////////////////////////////////////////////////////// protected virtual CResultAErreur MyFillFromElementDeGraphe(CElementDeArbreOperationnel elementSource) { return(CResultAErreur.True); }