public SlidingTabStrip(Context context, IAttributeSet attrs)
            : base(context, attrs)
        {
            SetWillNotDraw(false);

            var density = Resources.DisplayMetrics.Density;

            var outValue = new TypedValue();
            context.Theme.ResolveAttribute(Resource.Attribute.ColorForeground, outValue, true);
            var themeForeGround = outValue.Data;
            _mDefaultBottomBorderColor = SetColorAlpha(themeForeGround, DefaultBottomBorderColorAlpha);

            _mDefaultTabColorizer = new SimpleTabColorizer();
            _mDefaultTabColorizer.IndicatorColors = _indicatorColors;
            _mDefaultTabColorizer.DividerColors = _dividerColors;

            _mBottomBorderThickness = (int) (DefaultBottomBorderThicknessDips*density);
            _mBottomBorderPaint = new Paint();
            _mBottomBorderPaint.Color = GetColorFromInteger(0xC5C5C5); //Gray

            _mSelectedIndicatorThickness = (int) (SelectedIndicatorThicknessDips*density);
            _mSelectedIndicatorPaint = new Paint();

            _mDividerHeight = DefaultDividerHeight;
            _mDividerPaint = new Paint();
            _mDividerPaint.StrokeWidth = (int) (DefaultDividerThicknessDips*density);
        }
Example #2
0
 public GameRules(uint id, Client client) : base(id, client) {
     GameState = bindE<GameState>("DT_DOTAGamerules", "m_nGameState");
     GameTime = bind<float>("DT_DOTAGamerules", "m_fGameTime");
     HeroPickState = bind<uint>("DT_DOTAGamerules", "m_nHeroPickState");
     HeroPickStateTransitionTime = bind<float>("DT_DOTAGamerules", "m_flHeroPickStateTransitionTime");
     PreGameStartTime = bind<float>("DT_DOTAGamerules", "m_flPreGameStartTime");
 }
Example #3
0
        public Player(uint id, DotaGameState state) : base(id, state)
        {
            const string t = "DT_DOTAPlayer";

            PlayerId = bind<uint>(t, "m_iPlayerID");
            Hero = handle(t, "m_hAssignedHero");
        }
Example #4
0
        public void TestBrepUnion()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            var tvs = new TypedValue[] { new TypedValue((int)DxfCode.Start, "LWPOLYLINE") };
            var selFilter = new SelectionFilter(tvs);
            var sel = ed.GetSelection(selFilter);
            if (sel.Status != PromptStatus.OK) return;

            using (var t = db.TransactionManager.StartTransaction())
            {
                var idsPls = sel.Value.GetObjectIds();
                List<Polyline> pls = new List<Polyline>();
                foreach (var item in idsPls)
                {
                    var pl = item.GetObject(OpenMode.ForRead) as Polyline;
                    pls.Add(pl);
                }

                Region union = BrepExtensions.Union(pls, null);

                //var cs = db.CurrentSpaceId.GetObject(OpenMode.ForWrite) as BlockTableRecord;
                //if (union != null)
                //{
                //    cs.AppendEntity(union);
                //    t.AddNewlyCreatedDBObject(union, true);
                //}

                t.Commit();
            }
        }
        public SlidingTabStrip1(Context context, IAttributeSet attrs)
            : base(context, attrs)
        {
            SetWillNotDraw(false);

            float density = Resources.DisplayMetrics.Density;

            TypedValue outValue = new TypedValue();
            context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true);
            int themeForeGround = outValue.Data;
            mDefaultBottomBorderColor = SetColorAlpha(themeForeGround, DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);

            mDefaultTabColorizer = new SimpleTabColorizer1();
            mDefaultTabColorizer.IndicatorColors = INDICATOR_COLORS;
            mDefaultTabColorizer.DividerColors = DIVIDER_COLORS;

            mBottomBorderThickness = (int)(DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
            mBottomBorderPaint = new Paint();
            mBottomBorderPaint.Color = GetColorFromInteger(0xC5C5C5); //Gray

            mSelectedIndicatorThickness = (int)(SELECTED_INDICATOR_THICKNESS_DIPS * density);
            mSelectedIndicatorPaint = new Paint();

            mDividerHeight = DEFAULT_DIVIDER_HEIGHT;
            mDividerPaint = new Paint();
            mDividerPaint.StrokeWidth = (int)(DEFAULT_DIVIDER_THICKNESS_DIPS * density);
        }
 public TypedValue[] ActualValues(CellProcessor processor, object theActualRow)
 {
     var actuals = (object[]) theActualRow;
     var result = new TypedValue[actuals.Length];
     for (int i = 0; i < actuals.Length; i++) result[i] = new TypedValue(actuals[i]);
     return result;
 }
		public SlidingTabStrip(Context context, IAttributeSet Attrs):base(context, Attrs) {
			SetWillNotDraw(false);

			float density = Resources.DisplayMetrics.Density;

			TypedValue outValue = new TypedValue();
			context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorForeground, outValue, true);
			int themeForegroundColor =  outValue.Data;

			_defaultBottomBorderColor = SetColorAlpha(themeForegroundColor,0x26);

			_defaultTabColorizer = new SimpleTabColorizer();
			_defaultTabColorizer.SetIndicatorColors(0xFF33B5);
			_defaultTabColorizer.SetDividerColors(SetColorAlpha(themeForegroundColor,0x20));

			_bottomBorderThickness = (int) (2 * density);
			_bottomBorderPaint = new Paint();
			_bottomBorderPaint.Color = Color.White;

			_selectedIndicatorThickness = (int) (6 * density);
			_selectedIndicatorPaint = new Paint();

			_dividerHeight = 0.5f;
			_dividerPaint = new Paint();
			_dividerPaint.StrokeWidth=((int) (1 * density));
		}
 public TypedValue[] ActualValues(CellProcessor processor, object theActualRow)
 {
     if (myColumnsUsed == null) myColumnsUsed = new bool[myHeaderRow.Parts.Size];
     var result = new TypedValue[myHeaderRow.Parts.Size];
     int column = 0;
     foreach (Parse headerCell in new CellRange(myHeaderRow.Parts).Cells) {
         TypedValue memberResult = new CellOperationImpl(processor).TryInvoke(theActualRow, headerCell);
         if (memberResult.IsValid) {
             result[column] = memberResult;
             myColumnsUsed[column] = true;
         }
         else {
             TypedValue itemResult = new CellOperationImpl(processor).TryInvoke(theActualRow,
                                                          new StringCellLeaf("getitem"),
                                                          new CellRange(headerCell, 1));
             if (itemResult.IsValid) {
                 result[column] = itemResult;
                 myColumnsUsed[column] = true;
             }
             else {
                 result[column] = TypedValue.Void;
             }
         }
         column++;
     }
     return result;
 }
Example #9
0
 private PromptSelectionResult GetCircles(Transaction trans)
 {
     TypedValue[] types = new TypedValue[] { new TypedValue((int)DxfCode.Start, "Circle") };
     SelectionFilter selectionFilter = new SelectionFilter(types);
     PromptSelectionResult selectedObject = editor.GetSelection(selectionFilter);
     return selectedObject;
 }
Example #10
0
 public static int GetAccentColor(Context context)
 {
     var typedValue = new TypedValue();
     TypedArray a = context.ObtainStyledAttributes(typedValue.Data, new int[] { Resource.Attribute.colorAccent });
     int color = a.GetColor(0, 0);
     a.Recycle();
     return color;
 }
Example #11
0
 public InvokeOperation(CellProcessor processor, TypedValue target, Tree<Cell> member, Tree<Cell> parameters, Tree<Cell> cells)
 {
     this.processor = processor;
     Target = target;
     Member = member;
     Parameters = parameters;
     Cells = cells;
 }
        public static TypedValue ProxyExplodeToBlock(ResultBuffer rbArgs)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            TypedValue res = new TypedValue((int)LispDataType.Text,"");

            if (rbArgs.AsArray().Length == 2)
            {
                TypedValue entity = rbArgs.AsArray()[0];
                TypedValue blkPrefix = rbArgs.AsArray()[1];

                if ((entity.TypeCode == (int)LispDataType.ObjectId) && (blkPrefix.TypeCode == (int)LispDataType.Text))
                {
                    using (Transaction tr = doc.TransactionManager.StartTransaction())
                    {
                        try
                        {
                            ObjectId id = (ObjectId)entity.Value;
                            DBObjectCollection objs = new DBObjectCollection();
                            BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);

                            Entity entx = (Entity)tr.GetObject(id, OpenMode.ForWrite);
                            entx.Explode(objs);

                            string blkName = blkPrefix.Value.ToString() + entx.Handle.ToString();

                            if (bt.Has(blkName) == false)
                            {
                                BlockTableRecord btr = new BlockTableRecord();
                                btr.Name = blkName;

                                bt.UpgradeOpen();
                                ObjectId btrId = bt.Add(btr);
                                tr.AddNewlyCreatedDBObject(btr, true);

                                foreach (DBObject obj in objs)
                                {
                                    Entity ent = (Entity)obj;
                                    btr.AppendEntity(ent);
                                    tr.AddNewlyCreatedDBObject(ent, true);
                                }
                            }
                            res = new TypedValue((int)LispDataType.Text, blkName);

                            tr.Commit();
                        }
                        catch (Autodesk.AutoCAD.Runtime.Exception ex)
                        {
                            tr.Abort();
                            ed.WriteMessage(ex.Message);
                        }
                    }
                }
            }
            return res;
        }
Example #13
0
 private string getXdataAllText(TypedValue[] typedValues)
 {
     StringBuilder sbText = new StringBuilder();
      foreach (var item in typedValues)
      {
     sbText.AppendLine(string.Format("TypeCode: {0}; Value: {1}", item.TypeCode, item.Value));
      }
      return sbText.ToString();
 }
Example #14
0
 public TypedValue DoInvoke(CellProcessor processor)
 {
     var targetInstance = new TypedValue(target);
     var targetObjectProvider = target as TargetObjectProvider;
     var name = GetMemberName(processor);
     return processor.Invoke(
             targetObjectProvider != null ? new TypedValue(targetObjectProvider.GetTargetObject()) : targetInstance,
             name, parameters);
 }
Example #15
0
        public Ability(uint id, DotaGameState state) : base(id, state)
        {
            const string t = "DT_DOTABaseAbility";

            Level = bind<uint>(t, "m_iLevel");
            Cooldown = bind<float>(t, "m_fCooldown");
            CooldownLength = bind<float>(t, "m_flCooldownLength");
            ManaCost = bind<uint>(t, "m_iManaCost");
            CastRange = bind<uint>(t, "m_iCastRange");
        }
Example #16
0
			public FunctionResolveResult(string functionName, bool treatAsOperator, TypedValue[] argsBefore, TypedValue[] argsAfter, IReadOnlyList<Expression> arguments)
			{
				this.functionPrefix = null;
				this.functionSuffix = null;
				this.functionName = functionName;
				this.treatAsOperator = treatAsOperator;
				this.argsBefore = argsBefore;
				this.argsAfter = argsAfter;
				this.arguments = arguments;
				this.excludeParenthesis = false;
			}
        public static void Initialize(Context context)
        {
            var wm = context.GetSystemService(Context.WindowService).JavaCast<IWindowManager>();
            var displayMetrics = new DisplayMetrics();
            wm.DefaultDisplay.GetMetrics(displayMetrics);
            density = displayMetrics.Density;

            var bg = new TypedValue();
            context.Theme.ResolveAttribute(Android.Resource.Attribute.ColorBackground, bg, true);
            DefaultBackground = new ColorDrawable(new Color(bg.Data));
        }
Example #18
0
			public static TypedValue[] MakeArguments(params object[] args)
			{
				var retval = new TypedValue[args.Length];

				for (var i = 0; i < args.Length; i++)
				{
					retval[i] = new TypedValue(args[i].GetType(), args[i]);
				}

				return retval;
			}
		Android.Graphics.Color GetColor()
		{
			int[] colorAttribute = { Android.Resource.Attribute.ColorButtonNormal };

			var typedValue = new TypedValue();
			var a = Context.ObtainStyledAttributes(typedValue.Data, colorAttribute);
			var color = a.GetColor(0, -1);
			a.Recycle();

			return color;
		}
Example #20
0
        public void Do(Tree<Cell> cell) {
            var instance = new TypedValue(targetProvider.GetTargetObject());
            if (cell.IsLeaf && cell.Value.Text.Length == 0) {
	            var actual = processor.Invoke(instance, GetMemberName(memberCell), new CellTree());
	            if (actual.IsValid) ShowActual(cell.Value, actual.Value);
            }
            else {
                var beforeCounts = new TestCounts(processor.TestStatus.Counts);
                processor.InvokeWithThrow(instance, GetMemberName(memberCell), new CellTree(cell));
                processor.TestStatus.MarkCellWithLastResults(cell.Value, beforeCounts);
            }
        }
		int TextAppearanceHeight(int textAppearance) {

			TypedValue typedValue = new TypedValue(); 
			activity.Theme.ResolveAttribute(textAppearance, typedValue, true);
			int[] textSizeAttr = new int[] { Android.Resource.Attribute.TextSize };
			int indexOfAttrTextSize = 0;
			TypedArray a = activity.ObtainStyledAttributes(typedValue.Data, textSizeAttr);
			int textSize = a.GetDimensionPixelSize(indexOfAttrTextSize, -1);
			a.Recycle();

			return textSize;
		}
Example #22
0
		internal static double GetThemeAttributeDp(this Context self, int resource)
		{
			using (var value = new TypedValue())
			{
				if (!self.Theme.ResolveAttribute(resource, value, true))
					return -1;

				var pixels = (double)TypedValue.ComplexToDimension(value.Data, self.Resources.DisplayMetrics);

				return self.FromPixels(pixels);
			}
		}
 public static ColorStateList GetActionTextColorStateList(Context context, int colorId)
 {
     TypedValue value = new TypedValue();
     context.Resources.GetValue(colorId, value, true);
     if (value.Type >= DataType.FirstColorInt && value.Type <= DataType.LastColorInt)
     {
         return GetActionTextStateList(context, new Color(value.Data));
     }
     else
     {
         return context.Resources.GetColorStateList(colorId);
     }
 }
Example #24
0
 public TypedValue Wrap(TypedValue result) {
     if (!result.HasValue) return result;
     if (result.Type.IsPrimitive) return result;
     if (result.Type == typeof(string)) return result;
     var wrapInterpreter = result.GetValueAs<Interpreter>();
     if (wrapInterpreter != null) return result;
     if (typeof (IEnumerable<object>).IsAssignableFrom(result.Type))
         return MakeInterpreter("fitlibrary.ArrayFixture", typeof(IEnumerable<object>), result.Value);
     if (typeof (IDictionary).IsAssignableFrom(result.Type))
         return MakeInterpreter("fitlibrary.SetFixture", typeof(IEnumerable), result.GetValue<IDictionary>().Values);
     if (typeof (DataTable).IsAssignableFrom(result.Type))
         return MakeInterpreter("fitlibrary.ArrayFixture", typeof(DataTable), result.Value);
     if (typeof (XmlDocument).IsAssignableFrom(result.Type))
         return MakeInterpreter("fitlibrary.XmlFixture", typeof(XmlDocument), result.Value);
     if (typeof (IEnumerable).IsAssignableFrom(result.Type))
         return MakeInterpreter("fitlibrary.ArrayFixture", typeof(IEnumerable), result.Value);
     if (typeof (IEnumerator).IsAssignableFrom(result.Type))
         return MakeInterpreter("fitlibrary.ArrayFixture", typeof(IEnumerator), result.Value);
     return MakeInterpreter(ParseInterpreter.DefaultFlowInterpreter, typeof (object), result.Value);
 }
Example #25
0
 public TypedValue[] ActualValues(object theActualRow) {
     if (myColumnsUsed == null) myColumnsUsed = new bool[myHeaderRow.Branches.Count];
     var result = new TypedValue[myHeaderRow.Branches.Count];
     int column = 0;
     foreach (Parse headerCell in myHeaderRow.Branches) {
         TypedValue actual = InvokeMethod(theActualRow, headerCell);
         if (!actual.IsValid) {
             actual = InvokeIndexerWithRawHeaderValue(theActualRow, headerCell);
         }
         if (actual.IsValid) {
             result[column] = actual;
             myColumnsUsed[column] = true;
         }
         else {
             result[column] = TypedValue.Void;
         }
         column++;
     }
     return result;
 }
Example #26
0
        public static void SelectEnt2()
        {
            //��ȡEditor����
               Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

                // ����ѡ��ѡ��
               PromptSelectionOptions selectionOp = new PromptSelectionOptions();
                 //����ѡ�񼯹�������ֻѡ������
                TypedValue[] filList = new TypedValue[1];
                filList[0] = new TypedValue((int)DxfCode.Start, "INSERT");
               SelectionFilter filter = new SelectionFilter(filList);

               PromptSelectionResult ssRes = ed.GetSelection(selectionOp, filter);
               if (ssRes.Status == PromptStatus.OK)
               {
                   SelectionSet SS = ssRes.Value;
                   int nCount = SS.Count;
                   ed.WriteMessage("ѡ����{0}����"  , nCount);
               }
        }
        private void Import_TextReader()
        {
            openFileDialog1.Filter = "Text files|*.txt;*.xml|All files|*.*";
            DialogResult dr = openFileDialog1.ShowDialog();
            if (dr != DialogResult.OK) return;

            TextReader sr = owner[field].Value as TextReader;
            string oldval = sr.ReadToEnd();

            FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
            try
            {
                owner[field] = new TypedValue(type, new StreamReader(fs));
            }
            catch (Exception ex)
            {
                owner[field] = new TypedValue(type, new StringReader(oldval));
                MainForm.IssueException(ex, "Text import failed.  Recovery attempted but resource may be corrupt.");
            }
            fs.Close();
        }
Example #28
0
        public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree<Cell> parameters) {
            var type = Processor.ApplicationUnderTest.FindType("fit.Parse").Type;

    		// lookup Fixture
			foreach (var member in FindMember(instance, memberName, type).Value)
			{
                return member.Invoke(new object[] { parameters.Value });
            }

			// lookup FlowKeywords
			var runtimeType = Processor.ApplicationUnderTest.FindType("fit.Fixtures.FlowKeywords");
			var runtimeMember = runtimeType.GetConstructor(2);
			var flowKeywords = runtimeMember.Invoke(new[] { instance.Value, Processor });

			foreach (var member in FindMember(flowKeywords, memberName, type).Value)
			{
				return member.Invoke(new object[] { parameters.Value });
			}
			
			return TypedValue.MakeInvalid(new MemberMissingException(instance.Type, memberName.Name, 1));
        }
Example #29
0
 public void AddLinesToGroup()
 {
     Editor editor = dwg.Editor;
     using (Transaction acadTrans = CurrentDatabase.TransactionManager.StartTransaction())
     {
         GroupsInformation groupsEntities = new GroupsInformation(acadTrans, CurrentDatabase);
         //Спрашиваем имя группы
         string GroupName = AskForGroup(true, groupsEntities.GroupList);
         if (GroupName != null)
         {
             // Готовим опции для запроса элементов группы
             PromptSelectionOptions acadSelectionOptions = new PromptSelectionOptions();
             acadSelectionOptions.MessageForAdding = "\nУкажите объекты группы " + GroupName;
             //Выделять будем только линии и полилинии. Создаем фильтр
             TypedValue[] acadFilterValues = new TypedValue[4];
             acadFilterValues.SetValue(new TypedValue((int)DxfCode.Operator, "<OR"),0);
             acadFilterValues.SetValue(new TypedValue((int)DxfCode.Start, "LINE"),1);
             acadFilterValues.SetValue(new TypedValue((int)DxfCode.Start, "LWPOLYLINE"),2);
             acadFilterValues.SetValue(new TypedValue((int)DxfCode.Operator, "OR>"),3);
             SelectionFilter acadSelFilter = new SelectionFilter(acadFilterValues);
             //Используем фильтр для выделения
             PromptSelectionResult acadSelSetPrompt = dwg.Editor.GetSelection(acadSelectionOptions, acadSelFilter);
             //Если выбраны объекты - едем дальше
             if (acadSelSetPrompt.Status == PromptStatus.OK)
             {
                 // Формируем коллекцию выделенных объектов
                 SelectionSet acadSelectedObjects = acadSelSetPrompt.Value;
                 // Проходим по каждому объекту в выделении
                 foreach (SelectedObject selectedObj in acadSelectedObjects)
                 {
                     if (selectedObj!=null)
                     {
                         groupsEntities.AppendGroupToObject(selectedObj.ObjectId, GroupName);
                     }
                 }
             }
         }
         acadTrans.Commit();
     }
 }
Example #30
0
		public static void SetWindowBackground(this AView view)
		{
			Context context = view.Context;
			using (var background = new TypedValue())
			{
				if (context.Theme.ResolveAttribute(global::Android.Resource.Attribute.WindowBackground, background, true))
				{
					string type = context.Resources.GetResourceTypeName(background.ResourceId).ToLower();
					switch (type)
					{
						case "color":
							var color = new AColor(ContextCompat.GetColor(context, background.ResourceId));
							view.SetBackgroundColor(color);
							break;
						case "drawable":
							using (Drawable drawable = ContextCompat.GetDrawable(context, background.ResourceId))
								view.SetBackground(drawable);
							break;
					}
				}
			}
		}
Example #31
0
 public bool CanCompose(TypedValue instance)
 {
     return(typeof(StoryTestSource).IsAssignableFrom(instance.Type));
 }
Example #32
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (Bootlegger.BootleggerClient.CurrentEvent == null)
            {
                Finish();
                return;
            }

            CurrentEvent = Bootlegger.BootleggerClient.CurrentEvent;

            SetTheme(Resource.Style.Theme_Normal);

            SetContentView(Resource.Layout.Review);


            //AndHUD.Shared.Show(this, Resources.GetString(Resource.String.loading), -1, MaskType.Black, null, null, true);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            Window.ClearFlags(WindowManagerFlags.TranslucentStatus);

            if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            {
                // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                // finally change the color
                Window.SetStatusBarColor(new Color(ContextCompat.GetColor(this, Android.Resource.Color.Transparent)));
            }

            //FindViewById<TextView>(Resource.Id.customTitle).Text = CurrentEvent.name;

            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetTitle(CurrentEvent.name);

            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetExpandedTitleTextAppearance(Resource.Style.ExpandedAppBar);
            Typeface font = ResourcesCompat.GetFont(this, Resource.Font.montserratregular);

            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).CollapsedTitleTypeface = font;
            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).ExpandedTitleTypeface  = font;

            FindViewById <AppBarLayout>(Resource.Id.appbar).SetExpanded(false, false);

            if (!string.IsNullOrEmpty(CurrentEvent.iconbackground) && !WhiteLabelConfig.REDUCE_BANDWIDTH)
            {
                Picasso.With(this).Load(CurrentEvent.iconbackground).CenterCrop().Fit().MemoryPolicy(MemoryPolicy.NoCache, MemoryPolicy.NoStore).Tag(this).Into(FindViewById <ImageView>(Resource.Id.defaultback), new Action(() =>
                {
                    var bitmap      = ((BitmapDrawable)FindViewById <ImageView>(Resource.Id.defaultback).Drawable).Bitmap;
                    Palette palette = Palette.From(bitmap).Generate();
                    int vibrant     = palette.GetLightVibrantColor(0);
                    if (vibrant == 0)
                    {
                        vibrant = palette.GetMutedColor(0);
                    }
                    int dark = palette.GetVibrantColor(0);
                    if (dark == 0)
                    {
                        dark = palette.GetLightMutedColor(0);
                    }
                    //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetContentScrimColor(vibrant);
                    //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetStatusBarScrimColor(dark);
                }), null);
            }
            else
            {
                Picasso.With(this).Load(Resource.Drawable.user_back).CenterCrop().Fit().Into(FindViewById <ImageView>(Resource.Id.defaultback));
                //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetContentScrimColor(Color.Transparent);
                //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetStatusBarScrimColor(dark);
            }

            FindViewById <TextView>(Resource.Id.organisedby).Text = CurrentEvent.organisedby;
            Picasso.With(this).Load(CurrentEvent.organiserprofile.Replace("sz=50", "")).Tag(this).Fit().Transform(new CircleTransform()).Into(FindViewById <ImageView>(Resource.Id.imgGravatar));

            FindViewById <TextView>(Resource.Id.contributors).Text  = Java.Lang.String.Format("%d", CurrentEvent.numberofcontributors);
            FindViewById <TextView>(Resource.Id.contributions).Text = Java.Lang.String.Format("%d", CurrentEvent.numberofclips);

            _pager = FindViewById <ViewPager>(Resource.Id.tabpager);

            capture = FindViewById <FloatingActionButton>(Resource.Id.capture);
            newedit = FindViewById <FloatingActionButton>(Resource.Id.newedit);
            newtag  = FindViewById <FloatingActionButton>(Resource.Id.newtag);


            capture.Click += CaptureClick;
            newedit.Click += Review_Click;
            newtag.Click  += Newtag_Click;

            var dip16 = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 16, Resources.DisplayMetrics);

            capture.LayoutParameters = new CoordinatorLayout.LayoutParams(capture.LayoutParameters)
            {
                Behavior = new MyFABAwareScrollingViewBehavior(this, capture, 0, _pager), Gravity = (int)(GravityFlags.End | GravityFlags.Right | GravityFlags.Bottom), MarginEnd = dip16, BottomMargin = dip16
            };
            newtag.LayoutParameters = new CoordinatorLayout.LayoutParams(newtag.LayoutParameters)
            {
                Behavior = new MyFABAwareScrollingViewBehavior(this, newtag, 1, _pager), Gravity = (int)(GravityFlags.End | GravityFlags.Right | GravityFlags.Bottom), MarginEnd = dip16, BottomMargin = dip16
            };
            newedit.LayoutParameters = new CoordinatorLayout.LayoutParams(newedit.LayoutParameters)
            {
                Behavior = new MyFABAwareScrollingViewBehavior(this, newedit, 2, _pager), Gravity = (int)(GravityFlags.End | GravityFlags.Right | GravityFlags.Bottom), MarginEnd = dip16, BottomMargin = dip16
            };

            _tabs            = FindViewById <Android.Support.Design.Widget.TabLayout>(Resource.Id.tabs);
            _tabs.TabGravity = 0;
            _tabs.TabMode    = 1;

            _adapter       = new ReviewPageAdapter(SupportFragmentManager, this);
            _pager.Adapter = _adapter;

            if (savedInstanceState == null)
            {
                myclips                    = new MyClipsFragment(this);
                myclips.OnPreview         += Myclips_OnPreview;
                myclips.OnRefresh         += Myclips_OnRefresh;
                myclips.OnEventInfoUpdate += Myclips_OnEventInfoUpdate;
                myclips.OnStartUpload     += Myclips_OnStartUpload;

                myedits             = new MyEditsFragment();
                myedits.OnOpenEdit += Myedits_OnOpenEdit;
                myedits.OnPreview  += Myedits_OnPreview;

                myingest            = new AllClipsFragment(AllClipsFragment.ClipViewMode.LIST);
                myingest.OnPreview += Myingest_OnPreview;
            }
            else
            {
                myclips                    = SupportFragmentManager.FindFragmentByTag("android:switcher:" + Resource.Id.tabpager + ":0") as MyClipsFragment;
                myclips.OnPreview         += Myclips_OnPreview;
                myclips.OnRefresh         += Myclips_OnRefresh;
                myclips.OnEventInfoUpdate += Myclips_OnEventInfoUpdate;
                myclips.OnStartUpload     += Myclips_OnStartUpload;

                myingest             = SupportFragmentManager.FindFragmentByTag("android:switcher:" + Resource.Id.tabpager + ":1") as AllClipsFragment;
                myingest.ChooserMode = AllClipsFragment.ClipViewMode.LIST;
                myingest.OnPreview  += Myingest_OnPreview;

                myedits = SupportFragmentManager.FindFragmentByTag("android:switcher:" + Resource.Id.tabpager + ":2") as MyEditsFragment;
                if (myedits == null)
                {
                    myedits = new MyEditsFragment();
                }

                myedits.OnOpenEdit += Myedits_OnOpenEdit;
                myedits.OnPreview  += Myedits_OnPreview;
            }

            //myedits.Reattach();

            _adapter.AddTab(GetString(Resource.String.videos), myclips, ReviewPageAdapter.TabType.CLIPS);
            _adapter.AddTab(GetString(Resource.String.tagging), myingest, ReviewPageAdapter.TabType.INGEST);
            _adapter.AddTab(GetString(Resource.String.edits), myedits, ReviewPageAdapter.TabType.EDITS);

            _pager.Post(() => {
                _tabs.SetupWithViewPager(_pager);
            });

            _pager.PageSelected += _pager_PageSelected;

            if (Intent?.GetBooleanExtra("needsperms", false) ?? false)
            {
                LoginFuncs.ShowError(this, new NeedsPermissionsException());
            }
        }
Example #33
0
 public override int CompareTo(TimeToken other) => other is null ? 1 : TypedValue.CompareTo(other.TypedValue);
Example #34
0
        public static float DpToPixels(Context context, float valueInDp)
        {
            DisplayMetrics metrics = context.Resources.DisplayMetrics;

            return(TypedValue.ApplyDimension(ComplexUnitType.Dip, valueInDp, metrics));
        }
Example #35
0
        addOrphanToDicts(string nameDict, Handle hPnt, Handle hBlkRef, Handle hLdr)
        {
            bool         exists;
            ObjectId     idDict = Dict.getNamedDictionary(nameDict, out exists);
            ResultBuffer rb     = null;

            TypedValue[] tvs = new TypedValue[2];
            tvs.SetValue(new TypedValue(1005, hBlkRef), 0);
            tvs.SetValue(new TypedValue(1005, hLdr), 1);
            rb = new ResultBuffer(tvs);
            Dict.addXRec(idDict, hPnt.ToString(), rb);

            Point3d pnt3dPnt = hPnt.getCogoPntCoordinates();

            Entity         ent      = hBlkRef.getObjectId().getEnt();
            BlockReference br       = (BlockReference)ent;
            Point3d        pnt3dBlk = br.Position;

            idDict = Dict.getNamedDictionary("ObjectDict", out exists);
            tvs    = new TypedValue[9];
            tvs.SetValue(new TypedValue(1000, hLdr.getObjectId().ToString()), 0);
            tvs.SetValue(new TypedValue(1000, nameDict), 1);
            tvs.SetValue(new TypedValue(1000, hLdr.ToString()), 2);
            tvs.SetValue(new TypedValue(1040, pnt3dPnt.X), 3);
            tvs.SetValue(new TypedValue(1040, pnt3dPnt.Y), 4);
            tvs.SetValue(new TypedValue(1040, 0.0), 5);
            tvs.SetValue(new TypedValue(1040, pnt3dBlk.X), 6);
            tvs.SetValue(new TypedValue(1040, pnt3dBlk.Y), 7);
            tvs.SetValue(new TypedValue(1040, 0.0), 8);

            rb = new ResultBuffer(tvs);
            string idBlkRef = hBlkRef.getObjectId().ToString();

            idBlkRef = idBlkRef.Replace("(", "");
            idBlkRef = idBlkRef.Replace(")", "");
            Dict.addXRec(idDict, idBlkRef, rb);

            tvs = new TypedValue[6];
            tvs.SetValue(new TypedValue(1000, hBlkRef.getObjectId().ToString()), 0);
            tvs.SetValue(new TypedValue(1000, nameDict), 1);
            tvs.SetValue(new TypedValue(1005, hPnt.ToString()), 2);
            tvs.SetValue(new TypedValue(1040, pnt3dPnt.X), 3);
            tvs.SetValue(new TypedValue(1040, pnt3dPnt.Y), 4);
            tvs.SetValue(new TypedValue(1040, 0.0), 5);

            rb = new ResultBuffer(tvs);
            string idLdr = hLdr.getObjectId().ToString();

            idLdr = idLdr.Replace("(", "");
            idLdr = idLdr.Replace(")", "");
            Dict.addXRec(idDict, idLdr, rb);

            idDict = Dict.getNamedDictionary("SearchDict", out exists);
            tvs    = new TypedValue[1];
            tvs.SetValue(new TypedValue(1005, hPnt), 0);
            rb = new ResultBuffer(tvs);
            string idPnt = hPnt.getObjectId().ToString();

            idPnt = idPnt.Replace("(", "");
            idPnt = idPnt.Replace(")", "");

            Dict.addXRec(idDict, idPnt, rb);
            hLnkAdds.Add(hPnt);
        }
Example #36
0
 public static PromptStatus SendBuffer(this Editor ed, TypedValue typedValue)
 {
     return(SendBuffer(ed, new ResultBuffer(typedValue)));
 }
 public TypedValue InvokeSpecial(TypedValue instance, MemberName memberName, Tree <Cell> parameters)
 {
     return(TypedValue.MakeInvalid(new MemberMissingException(instance.Type, memberName.Name, 1)));
 }
Example #38
0
        [Test] public void StringIsParsed()
        {
            TypedValue result = parse.Parse(typeof(string), TypedValue.Void, new TreeList <string>("stuff"));

            Assert.AreEqual("stuff", result.Value);
        }
Example #39
0
        public void MyCommand2()
        {
            Document            doc           = Application.DocumentManager.MdiActiveDocument;
            Database            db            = doc.Database;
            Editor              ed            = doc.Editor;
            PromptStringOptions stringoptions = new PromptStringOptions("\n输入要拆除的外部参照名");
            PromptResult        stringresult  = ed.GetString(stringoptions);
            string              xrefname      = "";

            if (stringresult.Status == PromptStatus.OK)
            {
                xrefname = stringresult.StringResult;
            }
            else
            {
                return;
            }

            TypedValue[] FilterRule = new TypedValue[]
            {
                new TypedValue((int)DxfCode.Operator, "<and"),
                new TypedValue((int)DxfCode.Start, "INSERT"),
                new TypedValue((int)DxfCode.BlockName, xrefname),
                new TypedValue((int)DxfCode.Operator, "and>"),
            };

            using (Transaction Trans = db.TransactionManager.StartTransaction())
            {
                try
                {
                    BlockTable bt         = Trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                    ArrayList  RecordList = new ArrayList();
                    ArrayList  BlockList  = new ArrayList();
                    foreach (ObjectId id in bt)
                    {
                        BlockTableRecord btr = Trans.GetObject(id, OpenMode.ForRead) as BlockTableRecord;
                        if (btr.IsFromExternalReference)
                        {
                            RecordList.Add(btr);
                        }
                        if (btr.IsLayout == false && btr.IsFromExternalReference == false)
                        {
                            BlockList.Add(btr);
                        }
                    }
                    if (RecordList.Count == 0)
                    {
                        ed.WriteMessage("\n图形中未找到任何外部参照!");
                        return;
                    }
                    var query = from BlockTableRecord record in RecordList
                                where record.Name == xrefname
                                select record;
                    if (!query.Any())
                    {
                        ed.WriteMessage("\n未找到名为 {0} 的外部参照!", xrefname);
                        return;
                    }
                    BlockTableRecord Btr = query.First();

                    PromptSelectionResult XrefSelection = ed.SelectAll(new SelectionFilter(FilterRule));
                    if (XrefSelection.Status == PromptStatus.OK)
                    {
                        ObjectId[] ids = XrefSelection.Value.GetObjectIds();
                        foreach (ObjectId ID in ids)
                        {
                            BlockReference xref = Trans.GetObject(ID, OpenMode.ForWrite, false, true) as BlockReference;
                            xref.Erase();
                        }
                    }

                    foreach (BlockTableRecord blockrecord in BlockList)
                    {
                        foreach (ObjectId id in blockrecord)
                        {
                            RXClass entityclass = id.ObjectClass;
                            if (entityclass.Name == "AcDbBlockReference")
                            {
                                BlockReference block = Trans.GetObject(id, OpenMode.ForWrite, false, true) as BlockReference;
                                if (block.Name == xrefname)
                                {
                                    block.Erase();
                                }
                            }
                        }
                    }

                    db.DetachXref(Btr.Id);

                    /*
                     * DBDictionary Layouts = Trans.GetObject(db.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary;
                     * ArrayList Layoutlist = new ArrayList();
                     * foreach (DBDictionaryEntry item in Layouts)
                     * {
                     *  Layoutlist.Add(item.Key);
                     * }
                     * foreach (string name in Layoutlist)
                     * {
                     *  TypedValue[] FilterRule = new TypedValue[]
                     * {
                     *  new TypedValue((int)DxfCode.Operator,"<and"),
                     *  new TypedValue((int)DxfCode.Start,"INSERT"),
                     *  new TypedValue((int)DxfCode.BlockName,xrefname),
                     *  new TypedValue((int)DxfCode.LayoutName,name),
                     *  new TypedValue((int)DxfCode.Operator,"and>"),
                     * };
                     *  PromptSelectionResult XrefSelection = ed.SelectAll(new SelectionFilter(FilterRule));
                     *  if(XrefSelection.Status == PromptStatus.OK)
                     *  {
                     *      ObjectId[] ids = XrefSelection.Value.GetObjectIds();
                     *      foreach(ObjectId ID in ids)
                     *      {
                     *          BlockReference xref = Trans.GetObject(ID, OpenMode.ForWrite) as BlockReference;
                     *          xref.Erase();
                     *      }
                     *  }
                     * }
                     */


                    Trans.Commit();
                }
                catch (Exception Ex)
                {
                    ed.WriteMessage("出错啦!{0}", Ex.ToString());
                }
                finally
                {
                    Trans.Dispose();
                }
            }
        }
Example #40
0
        public void TcQGJ_YJK_X()
        {
            int    num;
            int    num8;
            object obj2;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_16:
                num2 = 3;
                Database database = mdiActiveDocument.Database;
IL_1F:
                num2 = 4;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    TypedValue[] array  = new TypedValue[1];
                    Array        array2 = array;
                    TypedValue   typedValue;
                    typedValue..ctor(0, "LWPOLYLINE");
                    array2.SetValue(typedValue, 0);
                    SelectionFilter       selectionFilter = new SelectionFilter(array);
                    PromptSelectionResult selection       = mdiActiveDocument.Editor.GetSelection(selectionFilter);
                    if (selection.Status == 5100)
                    {
                        SelectionSet value      = selection.Value;
                        Entity       e          = (Entity)transaction.GetObject(value[0].ObjectId, 0);
                        Point3d      entCenter  = CAD.GetEntCenter(e);
                        double       num3       = entCenter.X;
                        double       num4       = entCenter.Y;
                        double       num5       = entCenter.X;
                        double       num6       = entCenter.Y;
                        IEnumerator  enumerator = value.GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            object         obj            = enumerator.Current;
                            SelectedObject selectedObject = (SelectedObject)obj;
                            e         = (Entity)transaction.GetObject(selectedObject.ObjectId, 0);
                            entCenter = CAD.GetEntCenter(e);
                            num3      = Math.Min(entCenter.X, num3);
                            num4      = Math.Min(entCenter.Y, num4);
                            num5      = Math.Max(entCenter.X, num5);
                            num6      = Math.Max(entCenter.Y, num6);
                        }
                        if (enumerator is IDisposable)
                        {
                            (enumerator as IDisposable).Dispose();
                        }
                        Point3d point3d_;
                        point3d_..ctor(num3, num4, 0.0);
                        Point3d point3d_2;
                        point3d_2..ctor(num5, num6, 0.0);
                        Class36.smethod_89(point3d_, point3d_2, Class36.double_0);
                    }
                    transaction.Commit();
                }
IL_1BD:
                num2 = 6;
                if (Information.Err().Number <= 0)
                {
                    goto IL_1E2;
                }
IL_1CE:
                num2 = 7;
                Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
IL_1E2:
                goto IL_25E;
IL_1E4:
                int num7 = num8 + 1;
                num8     = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num7);
IL_218:
                goto IL_253;
IL_21A:
                num8 = num2;
                if (num <= -2)
                {
                    goto IL_1E4;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_230 :;
            }
            catch when(endfilter(obj2 is Exception & num != 0 & num8 == 0))
            {
                Exception ex = (Exception)obj3;

                goto IL_21A;
            }
IL_253:
            throw ProjectData.CreateProjectError(-2146828237);
IL_25E:
            if (num8 != 0)
            {
                ProjectData.ClearProjectError();
            }
        }
Example #41
0
        [Test] public void DateIsParsed()
        {
            TypedValue result = parse.Parse(typeof(DateTime), TypedValue.Void, new TreeList <string>("03 Jan 2008"));

            Assert.AreEqual(new DateTime(2008, 1, 3), result.Value);
        }
Example #42
0
        public void TcQLJ_YJK()
        {
            int    num;
            int    num4;
            object obj;

            try
            {
IL_01:
                ProjectData.ClearProjectError();
                num = -2;
IL_09:
                int num2 = 2;
                Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument;
IL_16:
                num2 = 3;
                Database database = mdiActiveDocument.Database;
IL_1F:
                num2 = 4;
                using (Transaction transaction = database.TransactionManager.StartTransaction())
                {
                    TypedValue[] array  = new TypedValue[1];
                    Array        array2 = array;
                    TypedValue   typedValue;
                    typedValue..ctor(0, "LWPOLYLINE");
                    array2.SetValue(typedValue, 0);
                    SelectionFilter       selectionFilter = new SelectionFilter(array);
                    PromptSelectionResult selection       = mdiActiveDocument.Editor.GetSelection(selectionFilter);
                    if (selection.Status == 5100)
                    {
                        SelectionSet value = selection.Value;
                        if (value.Count == 1)
                        {
                            goto IL_27B;
                        }
                        Entity e  = null;
                        Entity e2 = null;
                        if (value.Count > 2)
                        {
                            e  = (Entity)transaction.GetObject(value[0].ObjectId, 0);
                            e2 = (Entity)transaction.GetObject(value[checked (value.Count - 1)].ObjectId, 0);
                        }
                        else if (value.Count == 2)
                        {
                            e  = (Entity)transaction.GetObject(value[0].ObjectId, 0);
                            e2 = (Entity)transaction.GetObject(value[1].ObjectId, 0);
                        }
                        Point3d point3d  = CAD.GetEntCenter(e);
                        Point3d point3d2 = CAD.GetEntCenter(e2);
                        if (point3d.X > point3d2.X)
                        {
                            Point3d point3d3 = point3d;
                            point3d  = point3d2;
                            point3d2 = point3d3;
                        }
                        else if (point3d.X == point3d2.X & point3d.Y > point3d2.Y)
                        {
                            Point3d point3d4 = point3d;
                            point3d  = point3d2;
                            point3d2 = point3d4;
                        }
                        if (Class36.double_0 == 0.0)
                        {
                            Class36.double_0 = 4.0;
                        }
                        Class36.smethod_91(point3d, point3d2, Class36.double_0);
                    }
                    transaction.Commit();
                }
IL_1DA:
                num2 = 6;
                if (Information.Err().Number <= 0)
                {
                    goto IL_1FF;
                }
IL_1EB:
                num2 = 7;
                Interaction.MsgBox(Information.Err().Description, MsgBoxStyle.OkOnly, null);
IL_1FF:
                goto IL_27B;
IL_201:
                int num3 = num4 + 1;
                num4     = 0;
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num3);
IL_235:
                goto IL_270;
IL_237:
                num4 = num2;
                if (num <= -2)
                {
                    goto IL_201;
                }
                @switch(ICSharpCode.Decompiler.ILAst.ILLabel[], num);
                IL_24D :;
            }
            catch when(endfilter(obj is Exception & num != 0 & num4 == 0))
            {
                Exception ex = (Exception)obj2;

                goto IL_237;
            }
IL_270:
            throw ProjectData.CreateProjectError(-2146828237);
IL_27B:
            if (num4 != 0)
            {
                ProjectData.ClearProjectError();
            }
        }
Example #43
0
        stakeGridPoints(ObjectId idAlign, List <POI> varPOI_STAKE, double staBeg = 0, double staEnd = 0, int side = 0, long begNum = 30000)
        {
            Alignment objAlign = (Alignment)idAlign.getEnt();
            double    dblStation = 0, dblOffset = 0;

            if ((side == 0))
            {
                if (double.Parse(fGrid.tbxOffsetH.Text) != 0)
                {
                    PromptStatus ps;
                    bool         escape = true;

                    Point3d varPntPick = UserInput.getPoint("Select side to place stake points: <ESC to Cancel>", Pub.pnt3dO, out escape, out ps, osMode: 8);
                    if (escape)
                    {
                        return;
                    }

                    objAlign.StationOffset(varPntPick.X, varPntPick.Y, ref dblStation, ref dblOffset);

                    if (System.Math.Abs(dblOffset) > 20.0)
                    {
                        DialogResult varResponse = MessageBox.Show(string.Format("\nPoint selected is more than 20' from Alignment: {0} \nContinue?", objAlign.Name, MessageBoxButtons.YesNo));

                        if (varResponse == DialogResult.No)
                        {
                            return;
                        }
                    }
                    if (dblOffset < 0)
                    {
                        side = -1;
                    }
                    else
                    {
                        side = 1;
                    }
                    fStake.Side = side;
                }
                else
                {
                    fStake.Side = 1;
                }
            }
            else
            {
                fStake.Side = side;
            }

            fStake.STAKE_LAYER = fGrid.tbxOffsetH.Text + "-OS-" + objAlign.Name;

            dblOffset = double.Parse(fGrid.tbxOffsetH.Text);
            string strName = fStake.NameStakeObject;

            double dblStaBeg = Math.roundDown3((objAlign.StartingStation));
            double dblStaEnd = Math.roundDown3((objAlign.EndingStation));

            uint lngPntNumBeg = Stake_Util.getBegPntNum();

            fStake.NextPntNum = lngPntNumBeg;

            CogoPointCollection cgPnts = CivilApplication.ActiveDocument.CogoPoints;

            fStake.POI_STAKED = new List <POI>();

            //**********PROCESS varPOI_STAKE*********************
            for (int i = 0; i <= varPOI_STAKE.Count; i++)
            {
                if (varPOI_STAKE[i].DescX == "")
                {
                    POI vPOI_STAKE = varPOI_STAKE[i];
                    vPOI_STAKE.DescX = vPOI_STAKE.Desc0;
                    varPOI_STAKE[i]  = vPOI_STAKE;
                }

                if (i == varPOI_STAKE.Count - 1)
                {
                    break;
                }

                double dblElev = varPOI_STAKE[i].Elevation;

                switch (varPOI_STAKE[i].Desc0)
                {
                case "AP":

                    switch (side)
                    {
                    case 1:
                        //right side

                        //counterclockwise
                        if (varPOI_STAKE[i].isRightHand)
                        {
                            if (fGrid.optPBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            else if (fGrid.optRBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT_RBC(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            //clockwise
                        }
                        else
                        {
                            Stake_Calc.doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                        }

                        break;

                    case -1:
                        //left side

                        //counterclockwise
                        if (varPOI_STAKE[i].isRightHand)
                        {
                            Stake_Calc.doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            //clockwise
                        }
                        else
                        {
                            if (fGrid.optPBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            else if (fGrid.optRBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT_RBC(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                        }

                        break;
                    }

                    break;

                default:

                    string strDesc = varPOI_STAKE[i].DescX;
                    double dblEasting = 0, dblNorthing = 0;
                    try
                    {
                        objAlign.PointLocation(varPOI_STAKE[i].Station, dblOffset * side, ref dblEasting, ref dblNorthing);
                    }
                    catch (IndexOutOfRangeException)
                    {
                        try
                        {
                            objAlign.PointLocation(varPOI_STAKE[i].Station - 0.01, dblOffset * side, ref dblEasting, ref dblNorthing);
                        }
                        catch (IndexOutOfRangeException)
                        {
                            objAlign.PointLocation(varPOI_STAKE[i].Station + 0.01, dblOffset * side, ref dblEasting, ref dblNorthing);
                        }
                    }

                    Point3d dblPnt = new Point3d(dblEasting, dblNorthing, varPOI_STAKE[i].Elevation);

                    string strOffset = dblOffset.ToString();
                    Stake_Calc.setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                    break;
                }
            }

            List <POI> varPOI_STAKED = fStake.POI_STAKED;
            int        k             = varPOI_STAKED.Count - 1;

            uint lngPntNumEnd = uint.Parse(varPOI_STAKED[k].PntNum);

            TypedValue[] tvs = new TypedValue[4] {
                new TypedValue(1001, "STAKE"),
                new TypedValue(1071, lngPntNumBeg),
                new TypedValue(1071, lngPntNumEnd),
                new TypedValue(1000, fStake.STAKE_LAYER)
            };

            idAlign.setXData(tvs, "STAKE");

            CgPnt_Group.updatePntGroup("SPNT");

            Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_STAKED), "STAKE", true, "STAKED");

            bool     exists = false;
            ObjectId idDict = Dict.getNamedDictionary("STAKE_PNTS", out exists);

            List <Point3d> dblPnts = new List <Point3d>();
            Point3d        pnt3d   = Pub.pnt3dO;

            for (int p = 0; p < varPOI_STAKED.Count; p++)
            {
                ObjectId idPnt = BaseObjs._civDoc.CogoPoints.GetPointByPointNumber(uint.Parse(varPOI_STAKED[p].PntNum));
                pnt3d = idPnt.getCogoPntCoordinates();
                dblPnts.Add(pnt3d);
                ResultBuffer rb = new ResultBuffer {
                    new TypedValue(1000, idPnt.getCogoPntNumber().ToString()),
                    new TypedValue(1005, idPnt.getHandle().ToString())
                };
                Dict.addXRec(idDict, idPnt.ToString(), rb);
            }

            dblPnts.Add(dblPnts[0]);
            Draw.addPoly(dblPnts, fStake.STAKE_LAYER, 9);

            Misc.logUsage("STAKE", (lngPntNumEnd - lngPntNumBeg + 1));
        }
Example #44
0
 public Tree <Cell> Compose(TypedValue instance)
 {
     return(instance.GetValueAs <StoryTestSource>().Parse(Processor));
 }
Example #45
0
        public static Hero NewInstance()
        {
            return(new Hero
            {
                Id = ByteString.CopyFrom(Id.ToByteArray()),
                Name = "Narmaya",
                Races = { Race.Draph },
                Gender = Gender.Female,
                MaxAttack = 12200,
                AttackLevels = { 10240 },
                MaxHp = 1330,
                HpLevels = { 1120 },
                MaxLevel = 100,
                BaseDoubleAttackRate = 6,
                BaseTripleAttackRate = 4.5,
                Element = Element.Dark,
                WeaponProficiencies = { EquipmentType.Katana },
                AvailablePerkIds =
                {
                    ExtendedMasteryPerks.AttackBoost,
                    ExtendedMasteryPerks.DefenseBoost,
                    ExtendedMasteryPerks.DoubleAttackRateBoost,
                    ExtendedMasteryPerks.CriticalHitRateBoost,
                    ExtendedMasteryPerks.ChargeAttackDamageBoost,
                    ExtendedMasteryPerks.AttackBoost,
                    ExtendedMasteryPerks.DefenseBoost,
                    ExtendedMasteryPerks.HpBoost,
                    ExtendedMasteryPerks.CriticalHitRateBoost,
                    ExtendedMasteryPerks.LightDamageReduction,
                    ExtendedMasteryPerks.AttackBoost,
                    ExtendedMasteryPerks.DarkAttackBoost,
                    ExtendedMasteryPerks.Reflect,
                    ExtendedMasteryPerks.HostilityReduction,
                    ExtendedMasteryPerks.SupportSkill,
                },
                ModelMetadata =
                {
                    new ModelMetadata
                    {
                        JsAssetPath = "npc/4eb50ec0-501e-4a4d-9935-48f1456d6b3f/model/0/npc_3040063000_03.js",
                        ConstructorName = "mc_npc_3040063000_03",
                        ImageAssets =
                        {
                            new ImageAsset
                            {
                                Name = "npc_3040063000_03_a",
                                Path = "npc/4eb50ec0-501e-4a4d-9935-48f1456d6b3f/model/0/npc_3040063000_03_a.png",
                            },
                            new ImageAsset
                            {
                                Name = "npc_3040063000_03_b",
                                Path = "npc/4eb50ec0-501e-4a4d-9935-48f1456d6b3f/model/0/npc_3040063000_03_b.png",
                            },
                        },
                    },
                },
                OnHitEffectModelMetadata =
                {
                    new ModelMetadata
                    {
                        JsAssetPath = "npc/4eb50ec0-501e-4a4d-9935-48f1456d6b3f/model/0/phit_3040063000.js",
                        ConstructorName = "mc_phit_3040063000_effect",
                        ImageAssets =
                        {
                            new ImageAsset
                            {
                                Name = "phit_3040063000",
                                Path = "npc/4eb50ec0-501e-4a4d-9935-48f1456d6b3f/model/0/phit_3040063000.png",
                            },
                        },
                    },
                },
                SpecialAbility = new SpecialAbility
                {
                    Name = string.Empty,
                    HitCount = { 1 },

                    ModelMetadata =
                    {
                        new ModelMetadata
                        {
                            JsAssetPath = "npc/4eb50ec0-501e-4a4d-9935-48f1456d6b3f/model/0/nsp_3040063000_03_s2.js",
                            ConstructorName = "mc_nsp_3040063000_03_s2_special",
                            ImageAssets =
                            {
                                new ImageAsset
                                {
                                    Name = "nsp_3040063000_03_s2",
                                    Path = "npc/4eb50ec0-501e-4a4d-9935-48f1456d6b3f/model/0/nsp_3040063000_03_s2.png",
                                },
                            },
                        },
                    },
                    ProcessEffects = (narmaya, raidActions) =>
                    {
                        if (narmaya.GlobalState[DawnflyDance].BooleanValue)
                        {
                            narmaya.ApplyStatusEffect(
                                new StatusEffectSnapshot
                            {
                                Id = StackableAttackUp,
                                Strength = 15,
                                StackingCap = 50,
                                IsStackable = true,
                                TurnDuration = int.MaxValue,
                                Modifier = ModifierLibrary.FlatAttackBoost,
                            },
                                raidActions);
                            if (narmaya.Hero.Rank == 5)
                            {
                                narmaya.ApplyStatusEffect(
                                    new StatusEffectSnapshot
                                {
                                    Id = StatusEffectLibrary.DarkAttackUpNpc,
                                    Strength = 30,
                                    TurnDuration = 4,
                                },
                                    raidActions);
                            }
                        }
                        else
                        {
                            narmaya.RemoveStatusEffect(StackableDefenseDown);
                            if (narmaya.Hero.Rank == 5)
                            {
                                narmaya.ApplyStatusEffect(
                                    new StatusEffectSnapshot
                                {
                                    Id = StatusEffectLibrary.MirrorImage,
                                    Strength = 2,
                                    TurnDuration = int.MaxValue,
                                },
                                    raidActions);
                            }
                        }
                    },
                },
                Abilities =
                {
                    ButterflyEffect(skillSealDuration: 2),
                    Transient(),
                    Kyogasuigetsu(),
                },
                UpgradedAbilities =
                {
                    new AbilityUpgrade
                    {
                        RequiredLevel = 45,
                        Ability = Kyogasuigetsu(),
                        UpgradedAbilityIndex = 2,
                    },
                    new AbilityUpgrade
                    {
                        RequiredLevel = 55,
                        Ability = ButterflyEffect(skillSealDuration: 1),
                        UpgradedAbilityIndex = 0,
                    },
                    new AbilityUpgrade
                    {
                        RequiredLevel = 100,
                        Ability = GlasswingWaltz(),
                        UpgradedAbilityIndex = 3,
                    },
                },
                OnActionStart = (narmaya, raidActions) => ProcessPassiveEffects(narmaya),
                OnSetup = (narmaya, allies, loadout) =>
                {
                    narmaya.GlobalState.Add(DawnflyDance, TypedValue.FromBool(true));
                    if (narmaya.Hero.Level >= 90)
                    {
                        narmaya.ApplyStatusEffect(
                            new StatusEffectSnapshot
                        {
                            Id = StatusEffectLibrary.Tenacity,
                            TurnDuration = int.MaxValue,
                        });
                    }
                },
                OnEnteringFrontline = (narmaya, raidActions) => ProcessPassiveEffects(narmaya),
                OnDeath = (narmaya, raidActions) =>
                {
                    foreach (var ally in narmaya.Raid.Allies)
                    {
                        if (ally.IsAlive() && ally.PositionInFrontline < 4)
                        {
                            ally.RemoveStatusEffect(FortifiedVigor);
                        }
                    }
                },
            });
        }
Example #46
0
 public void PushReturn(TypedValue value)
 {
     returnValues.Push(value);
 }
Example #47
0
 public static int GetPixelFromDp(Context context, float dp)
 {
     return((int)TypedValue.ApplyDimension(ComplexUnitType.Dip,
                                           dp, context.Resources.DisplayMetrics));
 }
Example #48
0
        [Test] public void StandardInstanceIsCreated()
        {
            TypedValue result = runtime.Create("System.Boolean", new TreeList <string>());

            Assert.IsTrue(result.Value is bool);
        }
        public TypedValue Parse(Type type, TypedValue instance, Tree <Cell> parameters)
        {
            string content = parameters.Value.Content;

            return(new TypedValue(content.Substring(1, content.Length - 2)));
        }
Example #50
0
        [Test] public void InstanceIsCreated()
        {
            TypedValue result = runtime.Create(typeof(SampleClass).FullName, new TreeList <string>());

            Assert.IsTrue(result.Value is SampleClass);
        }
 public bool CanInvokeSpecial(TypedValue instance, MemberName memberName, Tree <Cell> parameters)
 {
     return(true);
 }
Example #52
0
 public bool CanCompare(TypedValue actual, Tree <Cell> expected)
 {
     return(true);
 }
Example #53
0
 private void Init()
 {
     underlineHeight = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 2, Resources.DisplayMetrics);
 }
 // Calculates a screen dimension given a specified dimension in raw pixels
 internal static float CalculateScreenDimension(float pixels, ComplexUnitType screenUnitType = ComplexUnitType.Dip)
 {
     return(!DesignTime.IsDesignMode ?
            TypedValue.ApplyDimension(screenUnitType, pixels, GetDisplayMetrics()) : pixels);
 }
Example #55
0
 public bool CanCompose(TypedValue instance)
 {
     return(true);
 }
Example #56
0
        // 获取实体信息
        public void GetEntitiesInfo(ArrayList entities, Transaction trans, BlockTableRecord btr, int numSample, Document doc, Editor ed)
        {
            ArrayList uuid      = new ArrayList();
            ArrayList geom      = new ArrayList(); // 坐标点集合
            ArrayList colorList = new ArrayList(); // 颜色集合
            ArrayList type      = new ArrayList(); // 类型集合

            ArrayList layerName = new ArrayList();
            ArrayList tableName = new ArrayList();                                  // 表名

            System.Data.DataTable attributeList      = new System.Data.DataTable(); // 属性集合
            ArrayList             attributeIndexList = new ArrayList();             //属性索引集合

            ArrayList tuliList  = new ArrayList();                                  //图例集合
            string    projectId = "";                                               //项目ID
            string    chartName = "";                                               //表名称
            ArrayList kgGuide   = new ArrayList();                                  //控规引导

            string    srid         = "";                                            //地理坐标系统编号
            ArrayList parentId     = new ArrayList();                               //配套设施所在地块集合
            ArrayList textContent  = new ArrayList();                               // 文字内容(GIS端展示)
            ArrayList blockContent = new ArrayList();                               // 块内容(GIS端展示)

            Dictionary <string, string> result = new Dictionary <string, string>(); // 汇总

            // 遍历所有实体
            foreach (object entity in entities)
            {
                ArrayList singlePositionList = new ArrayList(); // 单个实体坐标点集合

                //取得边界数
                int loopNum = 1;
                if (entity is Hatch)
                {
                    loopNum = (entity as Hatch).NumberOfLoops;
                    type.Add("polygon");
                }

                Point3dCollection     col_point3d = new Point3dCollection();
                BulgeVertexCollection col_ver     = new BulgeVertexCollection();
                Curve2dCollection     col_cur2d   = new Curve2dCollection();

                for (int i = 0; i < loopNum; i++)
                {
                    col_point3d.Clear();
                    HatchLoop hatLoop = null;
                    if (entity is Hatch)
                    {
                        try
                        {
                            hatLoop = (entity as Hatch).GetLoopAt(i);
                        }
                        catch (System.Exception)
                        {
                            continue;
                        }

                        //如果HatchLoop为PolyLine
                        if (hatLoop.IsPolyline)
                        {
                            col_ver = hatLoop.Polyline;
                            foreach (BulgeVertex vertex in col_ver)
                            {
                                col_point3d.Add(new Point3d(vertex.Vertex.X, vertex.Vertex.Y, 0));
                            }
                        }
                    }

                    // 如果实体为Polyline
                    if (entity is Polyline)
                    {
                        // 类型
                        type.Add("polyline");

                        Polyline polyline = (Polyline)entity;

                        int vn = polyline.NumberOfVertices;
                        for (int w = 0; w < vn; w++)
                        {
                            Point2d pt = polyline.GetPoint2dAt(w);

                            col_point3d.Add(new Point3d(pt.X, pt.Y, 0));
                        }
                    }
                    //// 如果实体为Curve
                    //if (entity is Curve)
                    //{
                    //    col_cur2d = hatLoop.Curves;
                    //    foreach (Curve2d item in col_cur2d)
                    //    {
                    //        Point2d[] M_point2d = item.GetSamplePoints(numSample);
                    //        foreach (Point2d pt in M_point2d)
                    //        {
                    //            if (!col_point3d.Contains(new Point3d(pt.X, pt.Y, 0)))
                    //                col_point3d.Add(new Point3d(pt.X, pt.Y, 0));
                    //        }
                    //    }
                    //}
                    // 如果实体为Point2d
                    if (entity is DBPoint)
                    {
                        type.Add("point");

                        DBPoint entity3 = (DBPoint)entity;
                        col_point3d.Add(new Point3d(entity3.Position.X, entity3.Position.Y, 0));
                    }

                    // 如果实体为Point
                    if (entity is Point3d)
                    {
                        type.Add("point");

                        Point3d entity3 = (Point3d)entity;
                        col_point3d.Add(entity3);
                    }

                    // 如果实体为文字
                    if (entity is MText)
                    {
                        type.Add("text");

                        col_point3d.Add(new Point3d((entity as MText).Location.X, (entity as MText).Location.Y, 0));
                    }

                    // 如果实体为文字
                    if (entity is DBText)
                    {
                        type.Add("text");

                        col_point3d.Add(new Point3d((entity as DBText).Position.X, (entity as DBText).Position.Y, 0));
                    }

                    // 块参照
                    if (entity is BlockReference)
                    {
                        type.Add("block");

                        col_point3d.Add(new Point3d((entity as BlockReference).Position.X, (entity as BlockReference).Position.Y, 0));
                    }

                    double[] pointPositionList = new double[2]; //单个点的坐标点集合
                    // 经纬度转换
                    foreach (Point3d point in col_point3d)
                    {
                        pointPositionList = new double[2] {
                            Transform(point)[0], Transform(point)[1]
                        };
                        singlePositionList.Add(pointPositionList);
                    } // 经纬度转换结束
                }     // 单个实体几何坐标数量循环结束

                // UUID
                Entity entityLayer = (Entity)entity;

                Guid guid = new Guid();
                guid = Guid.NewGuid();
                string str = guid.ToString();
                uuid.Add(str);

                // 坐标
                geom.Add(singlePositionList);

                // 颜色
                if (entity is Point3d)
                {
                    colorList.Add("");
                    // 图层名
                    layerName.Add("无");
                }
                else
                {
                    LayerTableRecord ltr = (LayerTableRecord)trans.GetObject(entityLayer.LayerId, OpenMode.ForRead);

                    string color;
                    color = entityLayer.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(entityLayer.LayerId) : ColorTranslator.ToHtml(entityLayer.Color.ColorValue);

                    colorList.Add(color);
                    // 图层名
                    layerName.Add(ltr.Name);
                }

                // 表名
                tableName.Add("a");

                // 属性索引
                // 获取每个闭合多段线对应的个体编号和用地代号
                ArrayList             tagList = new ArrayList();
                PromptSelectionResult psrss   = ed.SelectCrossingPolygon(col_point3d); // 获取闭合区域内实体方法

                if (psrss.Status == PromptStatus.OK)
                {
                    tagList.Clear();

                    SelectionSet SS      = psrss.Value;
                    ObjectId[]   idArray = SS.GetObjectIds();

                    // 如果读取的块参照数量大于1,取中心点在闭合多段线的块参照
                    if (idArray.Length > 1)
                    {
                        for (int i = 0; i < idArray.Length; i++)
                        {
                            Entity ent1 = (Entity)idArray[i].GetObject(OpenMode.ForRead);
                            if (ent1 is BlockReference)
                            {
                                BlockReference ent2 = (BlockReference)ent1;
                                if (IsInPolygon(ent2.Position, col_point3d))
                                {
                                    foreach (ObjectId rt in ((BlockReference)ent1).AttributeCollection)
                                    {
                                        DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                                        AttributeReference acAttRef = dbObj as AttributeReference;

                                        tagList.Add(acAttRef.TextString);

                                        //MessageBox.Show("Tag: " + acAttRef.Tag + "\n" +
                                        //                "Value: " + acAttRef.TextString + "\n");
                                    }
                                }
                            }
                        }
                    }
                    // 如果读取的块参照数量等于1,取中心点在闭合多段线的块参照
                    else
                    {
                        for (int i = 0; i < idArray.Length; i++)
                        {
                            Entity ent1 = (Entity)idArray[i].GetObject(OpenMode.ForRead);
                            if (ent1 is BlockReference)
                            {
                                foreach (ObjectId rt in ((BlockReference)ent1).AttributeCollection)
                                {
                                    DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                                    AttributeReference acAttRef = dbObj as AttributeReference;

                                    tagList.Add(acAttRef.TextString);
                                }
                            }
                        }
                    }
                }
                // 如果地块编码属性只有两个属性值,attributeIndexList,如果少于2个或者多于2个都视为异常,添加空。
                if (tagList.Count == 2)
                {
                    attributeIndexList.Add(tagList[0] + "_" + tagList[1]);
                }
                else
                {
                    attributeIndexList.Add("");
                }

                // 属性
                readAttributeList attributeListObj = new readAttributeList();
                attributeList = attributeListObj.AttributeList();

                // 配套设施所属的地块UUID

                // 获取块参照的属性值
                ArrayList blockAttribute = new ArrayList();
                // 是否是地块编码本身
                string isBlockNum = "";

                // 如果这个块标注是幼儿园、公厕等,找对对应的地块编号或UUID
                if (entity is BlockReference)
                {
                    // 清除原有内容
                    blockAttribute.Clear();

                    // 如果entity有两个属性值,可以判断这是一个地块编码
                    if (((BlockReference)entity).AttributeCollection.Count == 2)
                    {
                        isBlockNum = "Block";
                    }

                    // 获取地块界限图层上的所有实体
                    ArrayList polylineEntities = new ArrayList();

                    // 找出地块界限里的所有闭合多段线,并判断当前块标注实体是否在某一个闭合多段线内,如果在,找出该闭合多段线内的块参照个体编号
                    TypedValue[] tvs =
                        new TypedValue[1] {
                        new TypedValue(
                            (int)DxfCode.LayerName,
                            "地块界限"
                            )
                    };

                    SelectionFilter       sf  = new SelectionFilter(tvs);
                    PromptSelectionResult psr = ed.SelectAll(sf);

                    if (psr.Status == PromptStatus.OK)
                    {
                        SelectionSet SS      = psr.Value;
                        ObjectId[]   idArray = SS.GetObjectIds();

                        //MessageBox.Show(idArray.Length.ToString());

                        Point3dCollection polylinePoint3d = new Point3dCollection();

                        for (int j = 0; j < idArray.Length; j++)
                        {
                            // 清除原有内容
                            polylinePoint3d.Clear();

                            Entity ent1 = trans.GetObject(idArray[j], OpenMode.ForWrite) as Entity;
                            if (ent1 is Polyline && (ent1 as Polyline).Closed)
                            {
                                Polyline polyline = (Polyline)ent1;

                                int vn = polyline.NumberOfVertices;
                                for (int w = 0; w < vn; w++)
                                {
                                    Point2d pt = polyline.GetPoint2dAt(w);
                                    polylinePoint3d.Add(new Point3d(pt.X, pt.Y, 0));
                                }

                                // 获取闭合多段线(地块)内的所有实体
                                PromptSelectionResult psrss2 = ed.SelectCrossingPolygon(polylinePoint3d);
                                if (psrss2.Status == PromptStatus.OK)
                                {
                                    SelectionSet SS2      = psrss2.Value;
                                    ObjectId[]   idArray2 = SS2.GetObjectIds();

                                    // 如果读取的块参照数量大于1,且包含当前实体,找出当前块参照所在的闭合多段线
                                    if (idArray2.Length > 1)
                                    {
                                        for (int i = 0; i < idArray2.Length; i++)
                                        {
                                            Entity ent2 = (Entity)idArray2[i].GetObject(OpenMode.ForRead);

                                            // 判断是否是配套设施开始
                                            if (ent2 is BlockReference && (ent2 as BlockReference).Position.X == (entity as BlockReference).Position.X)
                                            {
                                                for (int k = 0; k < idArray2.Length; k++)
                                                {
                                                    Entity ent3 = (Entity)idArray2[k].GetObject(OpenMode.ForRead);
                                                    if (ent3 is BlockReference)
                                                    {
                                                        // 判断块参照中心点是否在闭合多段线内,只读取中心点在闭合多段线内的块参照
                                                        if (IsInPolygon((ent3 as BlockReference).Position, polylinePoint3d))
                                                        {
                                                            foreach (ObjectId rt in ((BlockReference)ent3).AttributeCollection)
                                                            {
                                                                DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                                                                AttributeReference acAttRef = dbObj as AttributeReference;

                                                                blockAttribute.Add(acAttRef.TextString);
                                                            }
                                                        }
                                                    }
                                                }
                                            } // 判断是否是配套设施结束
                                        }
                                    }
                                } // 获取闭合多段线(地块)内的所有实体结束
                            }
                        }
                    }
                } // 如果这个块标注是幼儿园、公厕等,找对对应的地块编号或UUID 结束

                // 如果地块编码属性只有两个属性值,而且不是地块编码块参照,添加到parentId,如果少于2个或者多于2个都视为异常,添加空。
                if (blockAttribute.Count == 2 && isBlockNum != "Block")
                {
                    parentId.Add(blockAttribute[0] + "_" + blockAttribute[1]);
                }
                else
                {
                    parentId.Add("");
                }

                // 文字内容(GIS端展示)
                if (entity is DBText)
                {
                    textContent.Add((entity as DBText).TextString);
                }
                else if (entity is MText)
                {
                    textContent.Add((entity as MText).Text);
                }
                else if (entity is BlockReference)
                {
                    List <string> singleBlockContent = new List <string>();
                    string        text = "";

                    if ((entity as BlockReference).AttributeCollection.Count > 0)
                    {
                        foreach (ObjectId rt in ((BlockReference)entity).AttributeCollection)
                        {
                            DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                            AttributeReference acAttRef = dbObj as AttributeReference;

                            text = text + acAttRef.TextString + "//";
                        }
                        text = text.Substring(0, text.Length - 2);
                    }

                    textContent.Add(text);
                }
                else
                {
                    textContent.Add("");
                }

                // 块内容(GIS端展示)
                if (entity is BlockReference)
                {
                    List <string> singleBlockContent = new List <string>();
                    string        text = "//";

                    foreach (ObjectId rt in ((BlockReference)entity).AttributeCollection)
                    {
                        DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                        AttributeReference acAttRef = dbObj as AttributeReference;

                        text = acAttRef.TextString + text;
                        //singleBlockContent.Add(acAttRef.TextString);
                    }
                    blockContent.Add(text);
                    //blockContent.Add(singleBlockContent);
                }
                else
                {
                    blockContent.Add("");
                }
            } // 所有的实体循环结束

            // 图例
            readAttributeList attributeListObj3 = new readAttributeList();

            //tuliList.Add(attributeListObj3.TuliList());
            tuliList.Add("");

            // 项目名
            //string projectIdBaseAddress = "http://172.18.84.70:8081/PDD/pdd/individual-manage!findAllProject.action";
            //var projectIdHttp = (HttpWebRequest)WebRequest.Create(new Uri(projectIdBaseAddress));

            //var response = projectIdHttp.GetResponse();

            //var stream = response.GetResponseStream();
            //var sr = new StreamReader(stream, Encoding.UTF8);
            //var content = sr.ReadToEnd();

            //MessageBox.Show(content);

            projectId = "D3DEC178-2C05-C5F1-F6D3-45729EB9436A";

            // 图表名或者叫文件名
            chartName = Path.GetFileName(ed.Document.Name);

            // 控规引导
            readAttributeList attributeListObj2 = new readAttributeList();

            kgGuide = attributeListObj2.KgGuide();

            //地理坐标系统编号
            srid = "4326";

            // 发文字信息
            RegulatoryPost.FenTuZe.FenTuZe.SendData(result, uuid, geom, colorList, type, layerName, tableName, attributeIndexList, attributeList, tuliList, projectId, chartName, kgGuide, srid, parentId, textContent, blockContent);
        }
Example #57
0
        public virtual FormField createFormField(ExecutionEntity executionEntity)
        {
            FormFieldImpl formField = new FormFieldImpl();

            // set id
            formField.Id = id;

            // set label (evaluate expression)
            VariableScope variableScope = executionEntity != null ? executionEntity : StartProcessVariableScope.SharedInstance;

            if (label != null)
            {
                object labelValueObject = label.getValue(variableScope);
                if (labelValueObject != null)
                {
                    formField.Label = labelValueObject.ToString();
                }
            }

            formField.BusinessKey = businessKey;

            // set type
            formField.Type = type;

            // set default value (evaluate expression)
            object defaultValue = null;

            if (defaultValueExpression != null)
            {
                defaultValue = defaultValueExpression.getValue(variableScope);

                if (defaultValue != null)
                {
                    formField.DefaultValue = type.convertFormValueToModelValue(defaultValue);
                }
                else
                {
                    formField.DefaultValue = null;
                }
            }

            // value
            TypedValue value = variableScope.getVariableTyped(id);

            if (value != null)
            {
                formField.Value = type.convertToFormValue(value);
            }
            else
            {
                // first, need to convert to model value since the default value may be a String Constant specified in the model xml.
                TypedValue typedDefaultValue = type.convertToModelValue(Variables.untypedValue(defaultValue));
                // now convert to form value
                formField.Value = type.convertToFormValue(typedDefaultValue);
            }

            // properties
            formField.Properties = properties;

            // validation
            IList <FormFieldValidationConstraint> validationConstraints = formField.ValidationConstraints;

            foreach (FormFieldValidationConstraintHandler validationHandler in validationHandlers)
            {
                // do not add custom validators
                if (!"validator".Equals(validationHandler.name))
                {
                    validationConstraints.Add(validationHandler.createValidationConstraint(executionEntity));
                }
            }

            return(formField);
        }
        public float GetNativeSize(float size)
        {
            var displayMetrics = Android.App.Application.Context.Resources.DisplayMetrics;

            return(TypedValue.ApplyDimension(ComplexUnitType.Dip, size, displayMetrics));
        }
Example #59
0
        [Test] public void ClassWithStringConstructorIsParsed()
        {
            TypedValue result = parse.Parse(typeof(ClassFromString), TypedValue.Void, new TreeList <string>("stuff"));

            Assert.IsTrue(result.Value is ClassFromString);
        }
Example #60
0
        [Test] public void ClassIsParsed()
        {
            TypedValue result = parse.Parse(typeof(SampleClass), TypedValue.Void, new TreeList <string>("stuff"));

            Assert.IsTrue(result.Value is SampleClass);
        }