コード例 #1
0
        //-----------------------------------------------------------------------------------------------
        public void PerformOperation(MapOperation operation, WorkingMap workingMap)
        {
            if (operation.OpType == eInfluenceOpType.INFLUENCE_OP_NORMALIZE)
            {
                workingMap.Normalize();
                return;
            }

            string  operandMapID     = operation.InfluenceID;
            string  operandObjectTag = operation.ObjectTag;
            BaseMap operandMap       = InfluenceSystem.GetInstance().GetInfluenceMapByIDWithTag(operandMapID, operandObjectTag);

            switch (operation.OpType)
            {
            case eInfluenceOpType.INFLUENCE_OP_ADD:
            {
                workingMap.AddMap(operandMap, operation.Weight);
                break;
            }

            case eInfluenceOpType.INFLUENCE_OP_ADD_INVERSE:
            {
                workingMap.AddMapInverse(operandMap, operation.Weight);
                break;
            }

            case eInfluenceOpType.INFLUENCE_OP_MULTIPLY:
            {
                workingMap.MultiplyMap(operandMap, operation.Weight);
                break;
            }
            }
        }
コード例 #2
0
        //-----------------------------------------------------------------------------------------------
        public WorkingMap ConstructMapFromFormula()
        {
            WorkingMap workingMap = new WorkingMap();

            foreach (MapOperation operation in m_operationInstructions)
            {
                PerformOperation(operation, workingMap);
            }

            return(workingMap);
        }
コード例 #3
0
        //-----------------------------------------------------------------------------------------------
        public WorkingMap CreateMapWithFormula(string formulaID)
        {
            MapFormula formulaToCreate = GetMapFormulaByID(formulaID);

            if (formulaToCreate == null)
            {
                throw new ArgumentNullException("Formula: " + formulaID);
            }

            WorkingMap result = formulaToCreate.ConstructMapFromFormula();

            return(result);
        }
コード例 #4
0
        //-----------------------------------------------------------------------------------------------
        public InfluenceMapPoint GetPointOfHighestInfluenceForMap(string mapFormulaID)
        {
            WorkingMap mapResult = CreateMapWithFormula(mapFormulaID);

            return(mapResult.GetPointOfHighestInfluence());
        }