Example #1
0
 private void OpenResponse(Amqp.IConnection conn, Open openResp)
 {
     Tracer.InfoFormat("Connection {0}, Open {0}", conn.ToString(), openResp.ToString());
     Tracer.DebugFormat("Open Response : \n Hostname = {0},\n ContainerId = {1},\n MaxChannel = {2},\n MaxFrame = {3}\n", openResp.HostName, openResp.ContainerId, openResp.ChannelMax, openResp.MaxFrameSize);
     Tracer.DebugFormat("Open Response Descriptor : \n Descriptor Name = {0},\n Descriptor Code = {1}\n", openResp.Descriptor.Name, openResp.Descriptor.Code);
     ProcessCapabilities(openResp);
     ProcessRemoteConnectionProperties(openResp);
     if (SymbolUtil.CheckAndCompareFields(openResp.Properties, SymbolUtil.CONNECTION_ESTABLISH_FAILED, SymbolUtil.BOOLEAN_TRUE))
     {
         Tracer.InfoFormat("Open response contains {0} property the connection {1} will soon be closed.", SymbolUtil.CONNECTION_ESTABLISH_FAILED, this.ClientId);
     }
     else
     {
         object value = SymbolUtil.GetFromFields(openResp.Properties, SymbolUtil.CONNECTION_PROPERTY_TOPIC_PREFIX);
         if (value != null && value is string)
         {
             this.connInfo.TopicPrefix = value as string;
         }
         value = SymbolUtil.GetFromFields(openResp.Properties, SymbolUtil.CONNECTION_PROPERTY_QUEUE_PREFIX);
         if (value != null && value is string)
         {
             this.connInfo.QueuePrefix = value as string;
         }
         this.latch?.countDown();
     }
 }
Example #2
0
        internal void OnRemoteOpened(Open open)
        {
            if (SymbolUtil.CheckAndCompareFields(open.Properties, SymbolUtil.CONNECTION_ESTABLISH_FAILED, SymbolUtil.BOOLEAN_TRUE))
            {
                Tracer.InfoFormat("Open response contains {0} property the connection {1} will soon be closed.",
                                  SymbolUtil.CONNECTION_ESTABLISH_FAILED, Info.Id);
            }
            else
            {
                object value = SymbolUtil.GetFromFields(open.Properties, SymbolUtil.CONNECTION_PROPERTY_TOPIC_PREFIX);
                if (value is string topicPrefix)
                {
                    Info.TopicPrefix = topicPrefix;
                }

                value = SymbolUtil.GetFromFields(open.Properties, SymbolUtil.CONNECTION_PROPERTY_QUEUE_PREFIX);
                if (value is string queuePrefix)
                {
                    Info.QueuePrefix = queuePrefix;
                }

                this.tsc.SetResult(true);
                Provider.FireConnectionEstablished();
            }
        }
Example #3
0
        public void ClearRouteAnalyst(AxMapControl mapControl)
        {
            //清除所有图标
            SymbolUtil.ClearElement(mapControl);
            stopPoints.Clear();
            barryPoints.Clear();
            barryElements.Clear();
            stopElements.Clear();
            //清除网络分析图层
            for (int i = 0; i < mapControl.LayerCount; i++)
            {
                ILayer        layer        = mapControl.get_Layer(i);
                INetworkLayer networkLayer = layer as INetworkLayer;
                INALayer      naLayer      = layer as INALayer;
                if (networkLayer != null || naLayer != null)
                {
                    mapControl.DeleteLayer(i);
                }
            }
            //清除网络数据集
            ILayer datalayer = LayerUtil.QueryLayerInMap(mapControl, "网络数据集");

            if (datalayer != null)
            {
                mapControl.Map.DeleteLayer(datalayer);
            }
            IActiveView pActiveView = mapControl.ActiveView;

            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            mapControl.Refresh();
        }
Example #4
0
        private void SetPolylineMarkerSymbol(ISymbol symbol)
        {
            SimpleLineSymbolClass simpleLineSymbol = symbol as SimpleLineSymbolClass;

            simpleLineSymbol.Width = 2;
            simpleLineSymbol.Color = SymbolUtil.GetColor(255, 0, 99);
        }
        public void SymbolWOBody_IdentifierRange_Out()
        {
            int  line      = 2;
            int  character = 222;
            bool actual    = SymbolUtil.PositionIsWithinSymbolIdentifier(symbolWithoutBody, defaultUri, line, character);

            Assert.IsFalse(actual);
        }
        public SimpleCalculusService(IArticleConfigProfile configProfile) : base(configProfile)
        {
            ModuleAssembly = typeof(CalculusService).Assembly;

            ContractCode = SymbolUtil.GetContractCode();

            PositionCode = SymbolUtil.GetPositionCode();
        }
Example #7
0
 public void UpdateSymbol(AxMapControl mapControl)
 {
     SymbolUtil.ClearElement(mapControl);
     this.barryElements.Clear();
     this.stopElements.Clear();
     this.stopPoints.ForEach(point => stopElements.Add(SymbolUtil.DrawSymbolWithPicture(point, mapControl, Common.StopImagePath)));
     this.barryPoints.ForEach(point => barryElements.Add(SymbolUtil.DrawSymbolWithPicture(point, mapControl, Common.RouteBeakImggePath)));
 }
Example #8
0
        private void SetPointMarkerSymbol(ISymbol symbol)
        {
            SimpleMarkerSymbolClass simplePointSymbol = symbol as SimpleMarkerSymbolClass;

            simplePointSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
            simplePointSymbol.Size  = 5;
            simplePointSymbol.Color = SymbolUtil.GetColor(255, 0, 0);
        }
        public void Body_Outside1()
        {
            int  line      = 1;
            int  character = 0;
            bool actual    = SymbolUtil.PositionIsWithinSymbolBody(symbolWithBody, defaultUri, line, character);

            Assert.IsFalse(actual);
        }
        public void InBodyOfSymbolWOBody2()
        {
            int  line      = 3;
            int  character = 0;
            bool actual    = SymbolUtil.PositionIsWithinSymbolBody(symbolWithoutBody, defaultUri, line, character);

            Assert.IsFalse(actual);
        }
        public void SymbolWOBody_TotalRange_In()
        {
            int  line      = 3;
            int  character = 0;
            bool actual    = SymbolUtil.PositionIsWithinSymbolTotalRange(symbolWithoutBody, defaultUri, line, character);

            Assert.IsFalse(actual);
        }
        public void Identifier_Outside2()
        {
            int  line      = 2;
            int  character = -1;
            bool actual    = SymbolUtil.PositionIsWithinSymbolIdentifier(symbolWithBody, defaultUri, line, character);

            Assert.IsFalse(actual);
        }
        public void Wrongfile_totalRange()
        {
            int  line      = 2;
            int  character = 2;
            bool actual    = SymbolUtil.PositionIsWithinSymbolTotalRange(symbolInAnotherFile, defaultUri, line, character);

            Assert.IsFalse(actual);
        }
        public void Identifier_Inside()
        {
            int  line      = 2;
            int  character = 0;
            bool actual    = SymbolUtil.PositionIsWithinSymbolIdentifier(symbolWithBody, defaultUri, line, character);

            Assert.IsTrue(actual);
        }
        public void TotalRange_Outside2()
        {
            int  line      = 7;
            int  character = 0;
            bool actual    = SymbolUtil.PositionIsWithinSymbolTotalRange(symbolWithBody, defaultUri, line, character);

            Assert.IsFalse(actual);
        }
        public void TotalRange_Inside1()
        {
            int  line      = 3;
            int  character = 0;
            bool actual    = SymbolUtil.PositionIsWithinSymbolTotalRange(symbolWithBody, defaultUri, line, character);

            Assert.IsTrue(actual);
        }
Example #17
0
 public void UndoBarryPointSymbols(AxMapControl mapControl)
 {
     if (this.barryPoints.Count > 0)
     {
         this.barryPoints.RemoveAt(this.barryPoints.Count - 1);
         SymbolUtil.ClearElement(mapControl, this.barryElements[this.barryElements.Count - 1]);
         this.barryElements.RemoveAt(this.barryElements.Count - 1);
     }
 }
Example #18
0
        private void SetPolygonMarkerSymbol(ISymbol symbol)
        {
            SimpleFillSymbolClass simpleFillSymbol = symbol as SimpleFillSymbolClass;
            SimpleLineSymbolClass simpleLineSymbol = new SimpleLineSymbolClass();

            SetPolylineMarkerSymbol(simpleLineSymbol as ISymbol);
            simpleFillSymbol.Outline = simpleLineSymbol;
            simpleFillSymbol.Color   = SymbolUtil.GetColor(222, 222, 222);
        }
Example #19
0
        public void ResetStopPointSymbols(AxMapControl mapControl)
        {
            this.stopPoints.Clear();
            this.stopElements.ForEach(element => SymbolUtil.ClearElement(mapControl, element));
            this.stopElements.Clear();
            IActiveView pActiveView = mapControl.ActiveView;

            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            mapControl.Refresh();
        }
Example #20
0
        private Source CreateSource()
        {
            Source source = new Source();

            source.Address  = AmqpDestinationHelper.GetDestinationAddress(info.Destination, session.Connection);
            source.Outcomes = new[]
            {
                SymbolUtil.ATTACH_OUTCOME_ACCEPTED,
                SymbolUtil.ATTACH_OUTCOME_RELEASED,
                SymbolUtil.ATTACH_OUTCOME_REJECTED,
                SymbolUtil.ATTACH_OUTCOME_MODIFIED
            };
            source.DefaultOutcome = MessageSupport.MODIFIED_FAILED_INSTANCE;

            if (info.IsDurable)
            {
                source.ExpiryPolicy     = SymbolUtil.ATTACH_EXPIRY_POLICY_NEVER;
                source.Durable          = (int)TerminusDurability.UNSETTLED_STATE;
                source.DistributionMode = SymbolUtil.ATTACH_DISTRIBUTION_MODE_COPY;
            }
            else
            {
                source.ExpiryPolicy = SymbolUtil.ATTACH_EXPIRY_POLICY_SESSION_END;
                source.Durable      = (int)TerminusDurability.NONE;
            }

            if (info.IsBrowser)
            {
                source.DistributionMode = SymbolUtil.ATTACH_DISTRIBUTION_MODE_COPY;
            }

            source.Capabilities = new[] { SymbolUtil.GetTerminusCapabilitiesForDestination(info.Destination) };

            Map filters = new Map();

            if (info.NoLocal)
            {
                filters.Add(SymbolUtil.ATTACH_FILTER_NO_LOCAL, AmqpNmsNoLocalType.NO_LOCAL);
            }

            if (info.HasSelector)
            {
                filters.Add(SymbolUtil.ATTACH_FILTER_SELECTOR, new AmqpNmsSelectorType(info.Selector));
            }

            if (filters.Count > 0)
            {
                source.FilterSet = filters;
            }

            return(source);
        }
Example #21
0
        public void ShouldGetContractMonth(string symbol, int expected)
        {
            int actual = DatePool.GetSymbolMonth(symbol);

            if (SymbolUtil.GetSymbolType(symbol) == SymbolType.Spot)
            {
                int monthDifference = DateTime.Now.Month - 7;

                actual -= monthDifference;
            }

            Assert.Equal(expected, actual);
        }
Example #22
0
 public void RemoveBarryPoint(AxMapControl mapControl, IPoint point)
 {
     if (this.BarryPoints.Count > 0)
     {
         int index = JudgePointIsInCircle(this.barryPoints, point);
         if (index != -1)
         {
             this.barryPoints.RemoveAt(index);
             SymbolUtil.ClearElement(mapControl, this.barryElements[index]);
             this.barryElements.RemoveAt(index);
         }
     }
 }
Example #23
0
        private static void ShowRouteMethod(AxMapControl mapControl, IFeature pFeature)
        {
            IEnvelope pEnvelope = pFeature.Extent;
            double    width     = pEnvelope.Width;
            double    height    = pEnvelope.Height;

            pEnvelope.XMax   += width * 1.5;
            pEnvelope.XMin   -= width * 1.5;
            pEnvelope.YMax   += height * 1.5;
            pEnvelope.YMin   -= height * 1.5;
            mapControl.Extent = pEnvelope;
            SymbolUtil.DrawLineSymbol(mapControl, pFeature.Shape as IGeometry);
        }
        public void Negatives()
        {
            int startLine = -1;
            int startCol  = -1;
            int endLine   = -1;
            int endCol    = -1;

            int targetLine = 5;
            int targetCol  = 5;

            bool actual = SymbolUtil.Wraps(startLine, startCol, endLine, endCol, targetLine, targetCol);

            Assert.IsFalse(actual);
        }
        public void singleCharEdgeCase1out()
        {
            int startLine = 3;
            int startCol  = 3;
            int endLine   = 3;
            int endCol    = 4;

            int targetLine = 3;
            int targetCol  = 5;

            bool actual = SymbolUtil.Wraps(startLine, startCol, endLine, endCol, targetLine, targetCol);

            Assert.IsFalse(actual);
        }
        public void LineAfter()
        {
            int startLine = 3;
            int startCol  = 3;
            int endLine   = 7;
            int endCol    = 7;

            int targetLine = 9;
            int targetCol  = 9;

            bool actual = SymbolUtil.Wraps(startLine, startCol, endLine, endCol, targetLine, targetCol);

            Assert.IsFalse(actual);
        }
        public void targetAtSymbolEndMultiLine_1off()
        {
            int startLine = 3;
            int startCol  = 3;
            int endLine   = 7;
            int endCol    = 7;

            int targetLine = 7;
            int targetCol  = 8;

            bool actual = SymbolUtil.Wraps(startLine, startCol, endLine, endCol, targetLine, targetCol);

            Assert.IsFalse(actual);
        }
        public void zeroCharTheoreticalEdgeCase()
        {
            int startLine = 3;
            int startCol  = 3;
            int endLine   = 3;
            int endCol    = 3;

            int targetLine = 3;
            int targetCol  = 3;

            bool actual = SymbolUtil.Wraps(startLine, startCol, endLine, endCol, targetLine, targetCol);

            Assert.IsTrue(actual);
        }
        public void SameEndLineTrue()
        {
            int startLine = 3;
            int startCol  = 3;
            int endLine   = 7;
            int endCol    = 7;

            int targetLine = 7;
            int targetCol  = 1;

            bool actual = SymbolUtil.Wraps(startLine, startCol, endLine, endCol, targetLine, targetCol);

            Assert.IsTrue(actual);
        }
        public void targetAtSymbolStartMultiLine()
        {
            int startLine = 3;
            int startCol  = 3;
            int endLine   = 7;
            int endCol    = 7;

            int targetLine = 3;
            int targetCol  = 3;

            bool actual = SymbolUtil.Wraps(startLine, startCol, endLine, endCol, targetLine, targetCol);

            Assert.IsTrue(actual);
        }