Ejemplo n.º 1
0
        getPntStyle(string namePntStyle)
        {
            PointStyle pntStyle   = null;
            ObjectId   idPntStyle = ObjectId.Null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    PointStyleCollection pntStyles = BaseObjs._civDoc.Styles.PointStyles;
                    foreach (ObjectId id in pntStyles)
                    {
                        pntStyle = (PointStyle)tr.GetObject(id, OpenMode.ForRead);
                        if (pntStyle.Name == namePntStyle)
                        {
                            idPntStyle = pntStyle.ObjectId;
                            break;
                        }
                    }
                    if (idPntStyle == ObjectId.Null)
                    {
                        ObjectId idx = pntStyles.Add(namePntStyle);
                        pntStyle            = (PointStyle)tr.GetObject(idx, OpenMode.ForWrite);
                        pntStyle.MarkerType = PointMarkerDisplayType.UsePointForMarker;
                        idPntStyle          = pntStyle.ObjectId;
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Pnt_Style.cs: line: 207", ex.Message));
            }
            return(idPntStyle);
        }
Ejemplo n.º 2
0
        getPntStyle(string namePntStyle)
        {
            PointStyle pntStyle = null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    PointStyleCollection pntStyles = BaseObjs._civDoc.Styles.PointStyles;

                    foreach (ObjectId id in pntStyles)
                    {
                        pntStyle = (PointStyle)tr.GetObject(id, OpenMode.ForRead);
                        if (pntStyle.Name == namePntStyle)
                        {
                            return(pntStyle);
                        }
                    }
                    ObjectId idx = pntStyles.Add(namePntStyle);
                    pntStyle = (PointStyle)tr.GetObject(idx, OpenMode.ForRead); //pntStyle not defined
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Pnts.cs: line: 159", ex.Message));
            }
            return(pntStyle);
        }