Exemplo n.º 1
0
        private static CalculateCutLinesResponse CalculateCutCurvesRpc(
            [NotNull] ChangeAlongGrpc.ChangeAlongGrpcClient rpcClient,
            [NotNull] IList <Feature> selectedFeatures,
            [NotNull] IList <Feature> targetFeatures,
            CancellationToken cancellationToken)
        {
            var request = CreateCalculateCutLinesRequest(selectedFeatures, targetFeatures);

            return(TryRpc(
                       request,
                       r => rpcClient.CalculateCutLines(r, null, null, cancellationToken)));
        }
Exemplo n.º 2
0
        public static List <ResultFeature> ApplyCutCurves(
            [NotNull] ChangeAlongGrpc.ChangeAlongGrpcClient rpcClient,
            [NotNull] IList <Feature> sourceFeatures,
            [NotNull] IList <Feature> targetFeatures,
            [NotNull] IList <CutSubcurve> selectedSubcurves,
            CancellationToken cancellationToken,
            out ChangeAlongCurves newChangeAlongCurves)
        {
            Dictionary <GdbObjectReference, Feature> featuresByObjRef =
                CreateFeatureDictionary(sourceFeatures, targetFeatures);

            ApplyCutLinesRequest request =
                CreateApplyCutCurvesRequest(sourceFeatures, targetFeatures, selectedSubcurves);

            ApplyCutLinesResponse response =
                rpcClient.ApplyCutLines(request, null, null, cancellationToken);

            List <ResultObjectMsg> responseResultFeatures = response.ResultFeatures.ToList();

            var resultFeatures = new List <ResultFeature>();

            foreach (ResultObjectMsg resultObjectMsg in responseResultFeatures)
            {
                GdbObjectReference originalFeatureRef =
                    GetOriginalGdbObjectReference(resultObjectMsg);

                Feature originalFeature = featuresByObjRef[originalFeatureRef];

                ResultFeature resultFeature = new ResultFeature(
                    originalFeature, resultObjectMsg);

                resultFeatures.Add(resultFeature);
            }

            newChangeAlongCurves = PopulateReshapeAlongCurves(
                sourceFeatures, targetFeatures, response.NewCutLines,
                (ReshapeAlongCurveUsability)response.CutLinesUsability);

            return(resultFeatures);
        }
Exemplo n.º 3
0
        public static ChangeAlongCurves CalculateCutLines(
            [NotNull] ChangeAlongGrpc.ChangeAlongGrpcClient rpcClient,
            [NotNull] IList <Feature> sourceFeatures,
            [NotNull] IList <Feature> targetFeatures,
            CancellationToken cancellationToken)
        {
            var response =
                CalculateCutCurvesRpc(rpcClient, sourceFeatures, targetFeatures,
                                      cancellationToken);

            if (response == null || cancellationToken.IsCancellationRequested)
            {
                return(new ChangeAlongCurves(new List <CutSubcurve>(0),
                                             ReshapeAlongCurveUsability.Undefined));
            }

            var result = PopulateReshapeAlongCurves(
                sourceFeatures, targetFeatures, response.CutLines,
                (ReshapeAlongCurveUsability)response.ReshapeLinesUsability);

            return(result);
        }
Exemplo n.º 4
0
 protected override void ChannelOpenedCore(Channel channel)
 {
     RemoveOverlapsClient = new RemoveOverlapsGrpc.RemoveOverlapsGrpcClient(channel);
     ChangeAlongClient    = new ChangeAlongGrpc.ChangeAlongGrpcClient(channel);
     ReshapeClient        = new ReshapeGrpc.ReshapeGrpcClient(channel);
 }