Example #1
0
    void ToExpressionSet(ExpressionSet es)
    {
        //ExpressionSet es = new ExpressionSet();

        List <string> tokens = ExpressionParser.Parse(xInput.text);

        es.AddExpression("X", new Expression(tokens));
        tokens = ExpressionParser.Parse(yInput.text);
        es.AddExpression("Y", new Expression(tokens));
        tokens = ExpressionParser.Parse(zInput.text);
        es.AddExpression("Z", new Expression(tokens));

        if (uInput != null)
        {
            es.AddRange("u", ToRangePair(uInput.text));
        }
        if (vInput != null)
        {
            es.AddRange("v", ToRangePair(vInput.text));
        }
        if (wInput != null)
        {
            es.AddRange("w", ToRangePair(wInput.text));
        }
        if (tInput != null)
        {
            es.AddRange("t", ToRangePair(tInput.text));
        }

        //return es;
    }
Example #2
0
        //public IEnumerable<DocumentModel> SimplePassthroughQueryDocumentWithPath(string filename, string subject)
        //{

        //    List<DocumentModel> documentModels = new List<DocumentModel>();
        //    QueryResult queryResult;
        //    try
        //    {
        //        string queryString = "select dm_document.r_object_id, dm_document.subject, dm_document.a_content_type,dm_document.object_name,dm_format.dos_extension from dm_document,dm_format where  dm_document.a_content_type = dm_format.name";

        //        if ((!String.IsNullOrEmpty(filename)) && (!String.IsNullOrEmpty(subject)))
        //        {
        //            queryString = queryString + " and upper(object_name) like '%" + filename.ToUpper() + "%' and upper(subject) like '%" + subject.ToUpper() + "%'";
        //        }
        //        if ((!String.IsNullOrEmpty(filename)) && (String.IsNullOrEmpty(subject)))
        //        {
        //            queryString = queryString + " and upper(object_name) like '%" + filename.ToUpper() + "%'";
        //        }
        //        if ((String.IsNullOrEmpty(filename)) && (!String.IsNullOrEmpty(subject)))
        //        {
        //            queryString = queryString + " and upper(subject) like '%" + subject.ToUpper() + "%'";
        //        }
        //        int startingIndex = 0;
        //        int maxResults = 60;
        //        int maxResultsPerSource = 20;

        //        PassthroughQuery q = new PassthroughQuery();
        //        q.QueryString = queryString;
        //        q.AddRepository(DefaultRepository);

        //        QueryExecution queryExec = new QueryExecution(startingIndex,
        //                                                      maxResults,
        //                                                      maxResultsPerSource);
        //        queryExec.CacheStrategyType = CacheStrategyType.NO_CACHE_STRATEGY;

        //        queryResult = searchService.Execute(q, queryExec, null);

        //        QueryStatus queryStatus = queryResult.QueryStatus;
        //        RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0];
        //        if (repStatusInfo.Status == Status.FAILURE)
        //        {
        //            //  Console.WriteLine(repStatusInfo.ErrorTrace);
        //            documentModels.Add(new DocumentModel() { ObjectId = "0", ObjectName = repStatusInfo.ErrorMessage, Subject = repStatusInfo.ErrorTrace });
        //        }
        //        //Console.WriteLine("Query returned result successfully.");
        //        DataPackage dp = queryResult.DataPackage;
        //        //Console.WriteLine("DataPackage contains " + dp.DataObjects.Count + " objects.");
        //        foreach (DataObject dObj in dp.DataObjects)
        //        {
        //            PropertySet docProperties = dObj.Properties;
        //            String objectId = dObj.Identity.GetValueAsString();
        //            String docName = docProperties.Get("object_name").GetValueAsString();
        //            String Extension = docProperties.Get("dos_extension").GetValueAsString();
        //            string repName = dObj.Identity.RepositoryName;
        //            string docsubject = docProperties.Get("subject").GetValueAsString();
        //            //Console.WriteLine("RepositoryName: " + repName + " ,Document: " + objectId + " ,Name:" + docName + " ,Subject:" + docsubject);

        //            documentModels.Add(new DocumentModel() { ObjectId = objectId, ObjectName = docName+"."+Extension , Subject = docsubject });

        //        }
        //    }
        //    catch (Exception ex)
        //    {

        //        documentModels.Add(new DocumentModel() { ObjectId = "1", ObjectName = "SampleFile.txt", Subject = "This is a Sample" });
        //    }

        //    return documentModels;
        //}
        public void SimpleStructuredQuery(String docName)
        {
            String repoName = DefaultRepository;

            Console.WriteLine("Called SimpleStructuredQuery - " + DefaultRepository);
            PropertyProfile propertyProfile = new PropertyProfile();

            propertyProfile.FilterMode = PropertyFilterMode.IMPLIED;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.Profiles.Add(propertyProfile);

            // Create query
            StructuredQuery q = new StructuredQuery();

            q.AddRepository(repoName);
            q.ObjectType       = "dm_document";
            q.IsIncludeHidden  = true;
            q.IsDatabaseSearch = true;
            ExpressionSet expressionSet = new ExpressionSet();

            expressionSet.AddExpression(new PropertyExpression("object_name",
                                                               Condition.CONTAINS,
                                                               docName));
            q.RootExpressionSet = expressionSet;

            // Execute Query
            int            startingIndex       = 0;
            int            maxResults          = 60;
            int            maxResultsPerSource = 20;
            QueryExecution queryExec           = new QueryExecution(startingIndex,
                                                                    maxResults,
                                                                    maxResultsPerSource);
            QueryResult queryResult = searchService.Execute(q, queryExec, operationOptions);

            QueryStatus          queryStatus   = queryResult.QueryStatus;
            RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0];

            if (repStatusInfo.Status == Status.FAILURE)
            {
                Console.WriteLine(repStatusInfo.ErrorTrace);
                throw new Exception("Query failed to return result.");
            }
            Console.WriteLine("Query returned result successfully.");

            // print results
            Console.WriteLine("DataPackage contains " + queryResult.DataObjects.Count + " objects.");
            foreach (DataObject dataObject in queryResult.DataObjects)
            {
                Console.WriteLine(dataObject.Identity.GetValueAsString());
            }
        }
Example #3
0
    protected void HandleInput(string source)
    {
        List <string> x;
        List <string> y;
        List <string> z;
        List <string> umin = ExpressionParser.Parse("");
        List <string> umax = ExpressionParser.Parse("");
        List <string> tmin = ExpressionParser.Parse("");
        List <string> tmax = ExpressionParser.Parse("");
        List <string> vmin = ExpressionParser.Parse("");
        List <string> vmax = ExpressionParser.Parse("");
        List <string> wmin = ExpressionParser.Parse("");
        List <string> wmax = ExpressionParser.Parse("");

        ExpressionSet expressionSet = calcManager.expressionSet;

        switch (source)
        {
        default:
            x    = ExpressionParser.Parse("0.75*sin(2*pi*v)");
            y    = ExpressionParser.Parse("sin(pi*u)*(1.5+0.75*cos(2*pi*v))");
            z    = ExpressionParser.Parse("cos(pi*u)*(1.5+0.75*cos(2*pi*v))");
            umin = ExpressionParser.Parse("1.5");
            umax = ExpressionParser.Parse("2.5");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");

            List <string> x2    = ExpressionParser.Parse("0.75*cos(pi*u)");
            List <string> y2    = ExpressionParser.Parse("0.75*sin(pi*u)*cos(2*pi*v)+2.4");
            List <string> z2    = ExpressionParser.Parse("0.75*sin(pi*u)*sin(2*pi*v)+2.6");
            List <string> umin2 = ExpressionParser.Parse("0");
            List <string> umax2 = ExpressionParser.Parse("1");
            List <string> vmin2 = ExpressionParser.Parse("0");
            List <string> vmax2 = ExpressionParser.Parse("1");

            List <string> x3    = ExpressionParser.Parse("0.75*sin(2*pi*u)");
            List <string> y3    = ExpressionParser.Parse("0.75*cos(2*pi*u)+1.5*cos(pi/8*v)");
            List <string> z3    = ExpressionParser.Parse("-1.5*sin(pi/8*v)");
            List <string> umin3 = ExpressionParser.Parse("0");
            List <string> umax3 = ExpressionParser.Parse("1");
            List <string> vmin3 = ExpressionParser.Parse("0");
            List <string> vmax3 = ExpressionParser.Parse("1");

            List <string> x4    = ExpressionParser.Parse("0.75*sin(2*pi*u)");
            List <string> y4    = ExpressionParser.Parse("0.75*cos(2*pi*u)-1.5*cos(pi/8*v)");
            List <string> z4    = ExpressionParser.Parse("-1.5*sin(pi/8*v)");
            List <string> umin4 = ExpressionParser.Parse("0");
            List <string> umax4 = ExpressionParser.Parse("1");
            List <string> vmin4 = ExpressionParser.Parse("0");
            List <string> vmax4 = ExpressionParser.Parse("1");

            Expression X  = new Expression(x);
            Expression Y  = new Expression(y);
            Expression Z  = new Expression(z);
            Expression X2 = new Expression(x2);
            Expression Y2 = new Expression(y2);
            Expression Z2 = new Expression(z2);
            Expression X3 = new Expression(x3);
            Expression Y3 = new Expression(y3);
            Expression Z3 = new Expression(z3);
            Expression X4 = new Expression(x4);
            Expression Y4 = new Expression(y4);
            Expression Z4 = new Expression(z4);

            Range            zeroRange    = new Range(ExpressionParser.Parse("0"));
            Range            oneRange     = new Range(ExpressionParser.Parse("1"));
            Range            onePointFive = new Range(ExpressionParser.Parse("1.5"));
            Range            twoPointFive = new Range(ExpressionParser.Parse("2.5"));
            RangePair        zeroToZero   = new RangePair(zeroRange, zeroRange);
            RangePair        zeroToOne    = new RangePair(zeroRange, oneRange);
            List <RangePair> rangePairs   = new List <RangePair>()
            {
                zeroToZero, new RangePair(onePointFive, twoPointFive), zeroToOne, zeroToOne
            };
            List <RangePair> rangePairs2 = new List <RangePair>()
            {
                zeroToZero, zeroToOne, zeroToOne, zeroToZero
            };
            ExpressionSet expSet = new ExpressionSet(new string[] { "t", "u", "v", "w" }, rangePairs, new string[] { "X", "Y", "Z" }, new List <Expression>()
            {
                X, Y, Z
            });
            ExpressionSet expSet2 = new ExpressionSet(new string[] { "t", "u", "v", "w" }, rangePairs2, new string[] { "X", "Y", "Z" }, new List <Expression>()
            {
                X2, Y2, Z2
            });
            ExpressionSet expSet3 = new ExpressionSet(new string[] { "t", "u", "v", "w" }, rangePairs2, new string[] { "X", "Y", "Z" }, new List <Expression>()
            {
                X3, Y3, Z3
            });
            ExpressionSet expSet4 = new ExpressionSet(new string[] { "t", "u", "v", "w" }, rangePairs2, new string[] { "X", "Y", "Z" }, new List <Expression>()
            {
                X4, Y4, Z4
            });

            List <ExpressionSet> nanomeLogo = new List <ExpressionSet>()
            {
                expSet, expSet2, expSet3, expSet4
            };
            CalcManager.Instance.LoadSavedExpressionSets(nanomeLogo);
            print("unknown preset pressed");
            return;

        //R1 -> R1
        case "Cinquefoil Knot":
            x    = ExpressionParser.Parse("cos(t)*(2-cos(2*t/5))");
            y    = ExpressionParser.Parse("sin(t)*(2-cos(2*t/5))");
            z    = ExpressionParser.Parse("-sin(2*t/5)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("10*pi");
            break;

        case "Circle":
            x    = ExpressionParser.Parse("cos(t)");
            y    = ExpressionParser.Parse("sin(t)");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "Sphere Outline":
            x    = ExpressionParser.Parse("sin(t)*cos(32*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(32*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        case "Hypocloid":
            x    = ExpressionParser.Parse("cos(t)^3");
            y    = ExpressionParser.Parse("sin(t)^3");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Hypocloid Surface":
            x    = ExpressionParser.Parse("10*cos(t*32)^3");
            y    = ExpressionParser.Parse("10*sin(t*32)^3");
            z    = ExpressionParser.Parse("t-2*pi");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Trefoil Knot":
            x    = ExpressionParser.Parse("sin(t)+2*sin(2*t)");
            y    = ExpressionParser.Parse("cos(t)-2*cos(2*t)");
            z    = ExpressionParser.Parse("-sin(3*t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2*pi");
            break;

        case "Turnip":
            x    = ExpressionParser.Parse("(sin(t/16)^2)*cos(8*t)*8*pi");
            y    = ExpressionParser.Parse("(sin(t/16))^2*sin(8*t)*8*pi");
            z    = ExpressionParser.Parse("8*pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("16pi");
            break;

        case "Wavy Surface":
            x    = ExpressionParser.Parse("(sin(t/2)^(1/2)*cos(256*t)*pi)");
            y    = ExpressionParser.Parse("(sin(t/2))^(1/2)*sin(64*t)*pi");
            z    = ExpressionParser.Parse("pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "High-res Sphere":
            x    = ExpressionParser.Parse("sin(t)*cos(1024*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(1024*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        //R2->R3
        case "Astroidal Ellipse":
            x    = ExpressionParser.Parse("(2*cos(u)*cos(v))^3");
            y    = ExpressionParser.Parse("(2*sin(u)*cos(v))^3");
            z    = ExpressionParser.Parse("(2*sin(v))^3");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Bumpy Sphere":
            x    = ExpressionParser.Parse("5*sin(u)*sin(v)+cos(30*v)*0.15");
            y    = ExpressionParser.Parse("5*cos(u)*sin(v)+cos(30*u)*0.15");
            z    = ExpressionParser.Parse("5*cos(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("pi");
            break;

        case "Dini's Surface":
            x    = ExpressionParser.Parse("3*cos(u)*sin(v)");
            y    = ExpressionParser.Parse("3*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("3*(cos(v)+log(tan(0.5*v)))+0.4*u");
            umin = ExpressionParser.Parse("-4*pi");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0.005");
            vmax = ExpressionParser.Parse("3.135");
            break;

        case "Figure-8":
            x    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*cos(u)");
            y    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*sin(u)");
            z    = ExpressionParser.Parse("sin(u/2)*sin(v)-cos(u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Gray's Surface":
            x    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*cos(u/2)");
            y    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*sin(u/2)");
            z    = ExpressionParser.Parse("sin(3*u/2)*sin(v)+cos(3*u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Knot":
            x    = ExpressionParser.Parse("3*sin(3*u)/2+cos(v)))");
            y    = ExpressionParser.Parse("3*(sin(u)+2*sin(2*u))/(2+cos(v+pi*2/3))");
            z    = ExpressionParser.Parse("3/2*(cos(u)-2*cos(2*u))*(2+cos(v))*(2+cos(v+pi*2/3))/4");
            umin = ExpressionParser.Parse("-pi");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("-pi");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Mobius":
            x    = ExpressionParser.Parse("(5+u*cos(0.5*v))*cos(v)");
            y    = ExpressionParser.Parse("(5+u*cos(0.5*v))*sin(v)");
            z    = ExpressionParser.Parse("u*sin(0.5*v)");
            umin = ExpressionParser.Parse("-1");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Radial Wave":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("cos((u^2+v^2)^0.5)");
            umin = ExpressionParser.Parse("-10");
            umax = ExpressionParser.Parse("10");
            vmin = ExpressionParser.Parse("-10");
            vmax = ExpressionParser.Parse("10");
            break;

        case "Torus":
            x    = ExpressionParser.Parse("(5+cos(v))*cos(u)");
            y    = ExpressionParser.Parse("(5+cos(v))*sin(u)");
            z    = ExpressionParser.Parse("sin(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        //R3->R3
        case "Cone":
            x    = ExpressionParser.Parse("ucos(v)w");
            y    = ExpressionParser.Parse("usin(v)w");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cube":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cylinder":
            x    = ExpressionParser.Parse("ucos(v)");
            y    = ExpressionParser.Parse("usin(v)");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Sphere":
            x    = ExpressionParser.Parse("ucos(v)sin(w)");
            y    = ExpressionParser.Parse("usin(v)sin(w)");
            z    = ExpressionParser.Parse("ucos(w)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("2pi");
            break;

        case "Tetrahedron":
            x    = ExpressionParser.Parse("u(1-v)");
            y    = ExpressionParser.Parse("uv(1-w)");
            z    = ExpressionParser.Parse("uvw");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        // Orbitals
        case "S":
            x    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Px":
            x    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Py":
            x    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Pz":
            x    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dz\x00B2":
            goto case "Dz2";

        case "Dz2":
            x    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dxz":
            x    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dyz":
            x    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dxy":
            x    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dx\x00B2-y\x00B2":
            goto case "Dx2-y2";

        case "Dx2-y2":
            x    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fz\x00B3":
            goto case "Fz3";

        case "Fz3":
            x    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fxz\x00B2":
            goto case "Fxz2";

        case "Fxz2":
            x    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fyz\x00B2":
            goto case "Fyz2";

        case "Fyz2":
            x    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fxyz":
            x    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fz\x0028x\x00B2-y\x00B2\x0029":
            goto case "Fzx2y2";

        case "Fzx2y2":
            x    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fx\x0028x\x00B2-3y\x00B2\x0029":
            goto case "Fxx23y2";

        case "Fxx23y2":
            x    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fy\x00283x\x00B2-y\x00B2\x0029":
            goto case "Fy3x2y2";

        case "Fy3x2y2":
            x    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;
        }

        expressionSet.AddExpression("X", x);
        expressionSet.AddExpression("Y", y);
        expressionSet.AddExpression("Z", z);
        expressionSet.AddRange("t", tmin, tmax);
        expressionSet.AddRange("u", umin, umax);
        expressionSet.AddRange("v", vmin, vmax);
        expressionSet.AddRange("w", wmin, wmax);
        calcManager.PresetPressed();
    }
Example #4
0
    protected void HandleInput(string source)
    {
        List <string> x;
        List <string> y;
        List <string> z;
        List <string> umin = ExpressionParser.Parse("");
        List <string> umax = ExpressionParser.Parse("");
        List <string> tmin = ExpressionParser.Parse("");
        List <string> tmax = ExpressionParser.Parse("");
        List <string> vmin = ExpressionParser.Parse("");
        List <string> vmax = ExpressionParser.Parse("");
        List <string> wmin = ExpressionParser.Parse("");
        List <string> wmax = ExpressionParser.Parse("");

        ExpressionSet expressionSet = calcManager.expressionSet;

        switch (source)
        {
        default:
            x    = ExpressionParser.Parse("0");
            y    = ExpressionParser.Parse("0");
            z    = ExpressionParser.Parse("0");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("0");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("0");
            print("unknown preset pressed");
            break;

        //R1 -> R1
        case "Cinquefoil Knot":
            x    = ExpressionParser.Parse("cos(t)*(2-cos(2*t/5))");
            y    = ExpressionParser.Parse("sin(t)*(2-cos(2*t/5))");
            z    = ExpressionParser.Parse("-sin(2*t/5)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("10*pi");
            break;

        case "Circle":
            x    = ExpressionParser.Parse("cos(t)");
            y    = ExpressionParser.Parse("sin(t)");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "Sphere Outline":
            x    = ExpressionParser.Parse("sin(t)*cos(32*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(32*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        case "Hypocloid":
            x    = ExpressionParser.Parse("cos(t)^3");
            y    = ExpressionParser.Parse("sin(t)^3");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Hypocloid Surface":
            x    = ExpressionParser.Parse("10*cos(t*32)^3");
            y    = ExpressionParser.Parse("10*sin(t*32)^3");
            z    = ExpressionParser.Parse("t-2*pi");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Trefoil Knot":
            x    = ExpressionParser.Parse("sin(t)+2*sin(2*t)");
            y    = ExpressionParser.Parse("cos(t)-2*cos(2*t)");
            z    = ExpressionParser.Parse("-sin(3*t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2*pi");
            break;

        case "Turnip":
            x    = ExpressionParser.Parse("(sin(t/16)^2)*cos(8*t)*8*pi");
            y    = ExpressionParser.Parse("(sin(t/16))^2*sin(8*t)*8*pi");
            z    = ExpressionParser.Parse("8*pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("16pi");
            break;

        case "Wavy Surface":
            x    = ExpressionParser.Parse("(sin(t/2)^(1/2)*cos(256*t)*pi)");
            y    = ExpressionParser.Parse("(sin(t/2))^(1/2)*sin(64*t)*pi");
            z    = ExpressionParser.Parse("pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "High-res Sphere":
            x    = ExpressionParser.Parse("sin(t)*cos(1024*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(1024*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        //R2->R3
        case "Astroidal Ellipse":
            x    = ExpressionParser.Parse("(2*cos(u)*cos(v))^3");
            y    = ExpressionParser.Parse("(2*sin(u)*cos(v))^3");
            z    = ExpressionParser.Parse("(2*sin(v))^3");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Bumpy Sphere":
            x    = ExpressionParser.Parse("5*sin(u)*sin(v)+cos(30*v)*0.15");
            y    = ExpressionParser.Parse("5*cos(u)*sin(v)+cos(30*u)*0.15");
            z    = ExpressionParser.Parse("5*cos(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("pi");
            break;

        case "Dini's Surface":
            x    = ExpressionParser.Parse("3*cos(u)*sin(v)");
            y    = ExpressionParser.Parse("3*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("3*(cos(v)+log(tan(0.5*v)))+0.4*u");
            umin = ExpressionParser.Parse("-4*pi");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0.005");
            vmax = ExpressionParser.Parse("3.135");
            break;

        case "Figure-8":
            x    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*cos(u)");
            y    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*sin(u)");
            z    = ExpressionParser.Parse("sin(u/2)*sin(v)-cos(u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Gray's Surface":
            x    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*cos(u/2)");
            y    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*sin(u/2)");
            z    = ExpressionParser.Parse("sin(3*u/2)*sin(v)+cos(3*u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Knot":
            x    = ExpressionParser.Parse("3*sin(3*u)/2+cos(v)))");
            y    = ExpressionParser.Parse("3*(sin(u)+2*sin(2*u))/(2+cos(v+pi*2/3))");
            z    = ExpressionParser.Parse("3/2*(cos(u)-2*cos(2*u))*(2+cos(v))*(2+cos(v+pi*2/3))/4");
            umin = ExpressionParser.Parse("-pi");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("-pi");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Mobius":
            x    = ExpressionParser.Parse("(5+u*cos(0.5*v))*cos(v)");
            y    = ExpressionParser.Parse("(5+u*cos(0.5*v))*sin(v)");
            z    = ExpressionParser.Parse("u*sin(0.5*v)");
            umin = ExpressionParser.Parse("-1");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Radial Wave":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("cos((u^2+v^2)^0.5)");
            umin = ExpressionParser.Parse("-10");
            umax = ExpressionParser.Parse("10");
            vmin = ExpressionParser.Parse("-10");
            vmax = ExpressionParser.Parse("10");
            break;

        case "Torus":
            x    = ExpressionParser.Parse("(5+cos(v))*cos(u)");
            y    = ExpressionParser.Parse("(5+cos(v))*sin(u)");
            z    = ExpressionParser.Parse("sin(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        //R3->R3
        case "Cone":
            x    = ExpressionParser.Parse("ucos(v)w");
            y    = ExpressionParser.Parse("usin(v)w");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cube":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cylinder":
            x    = ExpressionParser.Parse("ucos(v)");
            y    = ExpressionParser.Parse("usin(v)");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Sphere":
            x    = ExpressionParser.Parse("ucos(v)sin(w)");
            y    = ExpressionParser.Parse("usin(v)sin(w)");
            z    = ExpressionParser.Parse("ucos(w)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("2pi");
            break;

        case "Tetrahedron":
            x    = ExpressionParser.Parse("u(1-v)");
            y    = ExpressionParser.Parse("uv(1-w)");
            z    = ExpressionParser.Parse("uvw");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;
        }

        expressionSet.AddExpression(ExpressionSet.ExpOptions.X, x);
        expressionSet.AddExpression(ExpressionSet.ExpOptions.Y, y);
        expressionSet.AddExpression(ExpressionSet.ExpOptions.Z, z);
        expressionSet.AddRange("t", tmin, tmax);
        expressionSet.AddRange("u", umin, umax);
        expressionSet.AddRange("v", vmin, vmax);
        expressionSet.AddRange("w", wmin, wmax);
        calcManager.PresetPressed();
    }
Example #5
0
    protected void HandleInput(string source)
    {
        List <string> x;
        List <string> y;
        List <string> z;
        List <string> umin = ExpressionParser.Parse("");
        List <string> umax = ExpressionParser.Parse("");
        List <string> tmin = ExpressionParser.Parse("");
        List <string> tmax = ExpressionParser.Parse("");
        List <string> vmin = ExpressionParser.Parse("");
        List <string> vmax = ExpressionParser.Parse("");
        List <string> wmin = ExpressionParser.Parse("");
        List <string> wmax = ExpressionParser.Parse("");

        ExpressionSet expressionSet = calcManager.expressionSet;

        switch (source)
        {
        default:
            x    = ExpressionParser.Parse("0");
            y    = ExpressionParser.Parse("0");
            z    = ExpressionParser.Parse("0");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("0");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("0");
            print("unknown preset pressed");
            break;

        //R1 -> R1
        case "Cinquefoil Knot":
            x    = ExpressionParser.Parse("cos(t)*(2-cos(2*t/5))");
            y    = ExpressionParser.Parse("sin(t)*(2-cos(2*t/5))");
            z    = ExpressionParser.Parse("-sin(2*t/5)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("10*pi");
            break;

        case "Circle":
            x    = ExpressionParser.Parse("cos(t)");
            y    = ExpressionParser.Parse("sin(t)");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "Sphere Outline":
            x    = ExpressionParser.Parse("sin(t)*cos(32*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(32*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        case "Hypocloid":
            x    = ExpressionParser.Parse("cos(t)^3");
            y    = ExpressionParser.Parse("sin(t)^3");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Hypocloid Surface":
            x    = ExpressionParser.Parse("10*cos(t*32)^3");
            y    = ExpressionParser.Parse("10*sin(t*32)^3");
            z    = ExpressionParser.Parse("t-2*pi");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Trefoil Knot":
            x    = ExpressionParser.Parse("sin(t)+2*sin(2*t)");
            y    = ExpressionParser.Parse("cos(t)-2*cos(2*t)");
            z    = ExpressionParser.Parse("-sin(3*t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2*pi");
            break;

        case "Turnip":
            x    = ExpressionParser.Parse("(sin(t/16)^2)*cos(8*t)*8*pi");
            y    = ExpressionParser.Parse("(sin(t/16))^2*sin(8*t)*8*pi");
            z    = ExpressionParser.Parse("8*pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("16pi");
            break;

        case "Wavy Surface":
            x    = ExpressionParser.Parse("(sin(t/2)^(1/2)*cos(256*t)*pi)");
            y    = ExpressionParser.Parse("(sin(t/2))^(1/2)*sin(64*t)*pi");
            z    = ExpressionParser.Parse("pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "High-res Sphere":
            x    = ExpressionParser.Parse("sin(t)*cos(1024*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(1024*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        //R2->R3
        case "Astroidal Ellipse":
            x    = ExpressionParser.Parse("(2*cos(u)*cos(v))^3");
            y    = ExpressionParser.Parse("(2*sin(u)*cos(v))^3");
            z    = ExpressionParser.Parse("(2*sin(v))^3");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Bumpy Sphere":
            x    = ExpressionParser.Parse("5*sin(u)*sin(v)+cos(30*v)*0.15");
            y    = ExpressionParser.Parse("5*cos(u)*sin(v)+cos(30*u)*0.15");
            z    = ExpressionParser.Parse("5*cos(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("pi");
            break;

        case "Dini's Surface":
            x    = ExpressionParser.Parse("3*cos(u)*sin(v)");
            y    = ExpressionParser.Parse("3*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("3*(cos(v)+log(tan(0.5*v)))+0.4*u");
            umin = ExpressionParser.Parse("-4*pi");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0.005");
            vmax = ExpressionParser.Parse("3.135");
            break;

        case "Figure-8":
            x    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*cos(u)");
            y    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*sin(u)");
            z    = ExpressionParser.Parse("sin(u/2)*sin(v)-cos(u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Gray's Surface":
            x    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*cos(u/2)");
            y    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*sin(u/2)");
            z    = ExpressionParser.Parse("sin(3*u/2)*sin(v)+cos(3*u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Knot":
            x    = ExpressionParser.Parse("3*sin(3*u)/2+cos(v)))");
            y    = ExpressionParser.Parse("3*(sin(u)+2*sin(2*u))/(2+cos(v+pi*2/3))");
            z    = ExpressionParser.Parse("3/2*(cos(u)-2*cos(2*u))*(2+cos(v))*(2+cos(v+pi*2/3))/4");
            umin = ExpressionParser.Parse("-pi");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("-pi");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Mobius":
            x    = ExpressionParser.Parse("(5+u*cos(0.5*v))*cos(v)");
            y    = ExpressionParser.Parse("(5+u*cos(0.5*v))*sin(v)");
            z    = ExpressionParser.Parse("u*sin(0.5*v)");
            umin = ExpressionParser.Parse("-1");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Radial Wave":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("cos((u^2+v^2)^0.5)");
            umin = ExpressionParser.Parse("-10");
            umax = ExpressionParser.Parse("10");
            vmin = ExpressionParser.Parse("-10");
            vmax = ExpressionParser.Parse("10");
            break;

        case "Torus":
            x    = ExpressionParser.Parse("(5+cos(v))*cos(u)");
            y    = ExpressionParser.Parse("(5+cos(v))*sin(u)");
            z    = ExpressionParser.Parse("sin(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        //R3->R3
        case "Cone":
            x    = ExpressionParser.Parse("ucos(v)w");
            y    = ExpressionParser.Parse("usin(v)w");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cube":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cylinder":
            x    = ExpressionParser.Parse("ucos(v)");
            y    = ExpressionParser.Parse("usin(v)");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Sphere":
            x    = ExpressionParser.Parse("ucos(v)sin(w)");
            y    = ExpressionParser.Parse("usin(v)sin(w)");
            z    = ExpressionParser.Parse("ucos(w)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("2pi");
            break;

        case "Tetrahedron":
            x    = ExpressionParser.Parse("u(1-v)");
            y    = ExpressionParser.Parse("uv(1-w)");
            z    = ExpressionParser.Parse("uvw");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        // Orbitals
        case "S":
            x    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Px":
            x    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Py":
            x    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Pz":
            x    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dz\x00B2":
            goto case "Dz2";

        case "Dz2":
            x    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dxz":
            x    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dyz":
            x    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dxy":
            x    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dx\x00B2-y\x00B2":
            goto case "Dx2-y2";

        case "Dx2-y2":
            x    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fz\x00B3":
            goto case "Fz3";

        case "Fz3":
            x    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fxz\x00B2":
            goto case "Fxz2";

        case "Fxz2":
            x    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fyz\x00B2":
            goto case "Fyz2";

        case "Fyz2":
            x    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fxyz":
            x    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fz\x0028x\x00B2-y\x00B2\x0029":
            goto case "Fzx2y2";

        case "Fzx2y2":
            x    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fx\x0028x\x00B2-3y\x00B2\x0029":
            goto case "Fxx23y2";

        case "Fxx23y2":
            x    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fy\x00283x\x00B2-y\x00B2\x0029":
            goto case "Fy3x2y2";

        case "Fy3x2y2":
            x    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;
        }

        expressionSet.AddExpression("X", x);
        expressionSet.AddExpression("Y", y);
        expressionSet.AddExpression("Z", z);
        expressionSet.AddRange("t", tmin, tmax);
        expressionSet.AddRange("u", umin, umax);
        expressionSet.AddRange("v", vmin, vmax);
        expressionSet.AddRange("w", wmin, wmax);
        calcManager.PresetPressed();
    }
Example #6
0
        /// <summary>
        /// Ricerca fulltext nell'oggetto document
        ///
        /// nb: da fare anche ricerca allegati
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public ArrayList FullTextSearch(ref FullTextSearchContext context)
        {
            ArrayList result = new ArrayList();

            try
            {
                List <string> fullTextResult = null;

                if (context.SearchResultList != null && context.SearchResultList.Length > 0)
                {
                    // Ricerca già effettuata, reperimento dall'oggetto di contesto
                    // dei risultati precedenti evitando così una dispendiosa
                    // chiamata al sistema documentale
                    fullTextResult = new List <string>(context.SearchResultList);
                }
                else
                {
                    StructuredQuery strQuery = new StructuredQuery();

                    strQuery.AddRepository(DctmConfigurations.GetRepositoryName());
                    strQuery.ObjectType = ObjectTypes.DOCUMENTO;

                    strQuery.IsDatabaseSearch     = false;
                    strQuery.IsIncludeAllVersions = false;
                    strQuery.IsIncludeHidden      = false;

                    // Inserisce nella ricerca il solo cabinet dell'amministrazione
                    RepositoryScope repositoryScope = new RepositoryScope();
                    repositoryScope.RepositoryName = DctmConfigurations.GetRepositoryName();
                    repositoryScope.LocationPath   = DocsPaAdminCabinet.getRootAmministrazione(this.InfoUtente);
                    repositoryScope.IsDescend      = true;
                    strQuery.Scopes.Add(repositoryScope);

                    ExpressionSet set = new ExpressionSet();
                    set.AddExpression(new FullTextExpression(context.TextToSearch));
                    strQuery.RootExpressionSet = set;

                    // Query execution
                    int            startIndex = (context.RequestedPageNumber * PAGE_SIZE) - PAGE_SIZE;
                    int            maxResults = this.GetMaxRowCount();
                    QueryExecution queryExec  = new QueryExecution(startIndex, maxResults, maxResults);

                    ISearchService searchService = DctmServiceFactory.GetServiceInstance <ISearchService>(this.InfoUtente.dst);
                    QueryResult    queryResult   = searchService.Execute(strQuery, queryExec, null);

                    QueryStatus          queryStatus   = queryResult.QueryStatus;
                    RepositoryStatusInfo repStatusInfo = queryResult.QueryStatus.RepositoryStatusInfos[0];

                    if (repStatusInfo.Status == Status.FAILURE)
                    {
                        throw new ApplicationException("QueryResult: Status.FAILURE");
                    }

                    fullTextResult = new List <string>();

                    foreach (DataObject dataObject in queryResult.DataObjects)
                    {
                        // Reperimento docnumber
                        string docNumber = dataObject.Properties.Get(TypeDocumento.DOC_NUMBER).GetValueAsString();

                        if (!fullTextResult.Contains(docNumber)) // Eliminazione dei risultati duplicati
                        {
                            fullTextResult.Add(docNumber);
                        }
                    }

                    context.SearchResultList = fullTextResult.ToArray();
                    context.TotalPageNumber  = (fullTextResult.Count / PAGE_SIZE);
                    context.TotalRecordCount = fullTextResult.Count;
                }

                // Paginazione dei risultati
                if (fullTextResult != null && fullTextResult.Count > 0)
                {
                    int startIndex = (context.RequestedPageNumber * PAGE_SIZE) - PAGE_SIZE;
                    int count      = PAGE_SIZE;
                    if (fullTextResult.Count < count)
                    {
                        count = fullTextResult.Count;
                    }
                    List <string> pageContent = fullTextResult.GetRange(startIndex, count);
                    result = this.GetDocuments(pageContent.ToArray(), InfoUtente);
                }
            }
            catch (Exception ex)
            {
                result.Clear();
                logger.Debug(string.Format("Errore in Documentum.FullTextSearch:\n{0}", ex.ToString()));
            }

            return(result);
        }
Example #7
0
        private ExpressionSet SetSearchExpressionSet(IEnumerable<KeyValuePair<string, string>> searchCriteria)
        {
            var expressionSet = new ExpressionSet();

            foreach (var criteria in searchCriteria)
            {
                expressionSet.AddExpression(new PropertyExpression(criteria.Key, Condition.EQUAL, criteria.Value));
            }

            return expressionSet;
        }
        public void SimpleStructuredQuery(String docName)
        {
            String repoName = DefaultRepository;

            PropertyProfile propertyProfile = new PropertyProfile();
            propertyProfile.FilterMode = PropertyFilterMode.IMPLIED;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.Profiles.Add(propertyProfile);

            // Create query
            StructuredQuery q = new StructuredQuery();
            q.AddRepository(repoName);
            q.ObjectType = "dm_document";
            q.IsIncludeHidden = true;
            q.IsDatabaseSearch = true;
            ExpressionSet expressionSet = new ExpressionSet();
            expressionSet.AddExpression(new PropertyExpression("object_name",
                                                               Condition.CONTAINS,
                                                               docName));
            q.RootExpressionSet = expressionSet;

            // Execute Query
            int startingIndex = 0;
            int maxResults = 60;
            int maxResultsPerSource = 20;
            QueryExecution queryExec = new QueryExecution(startingIndex,
                                                          maxResults,
                                                          maxResultsPerSource);
            QueryResult queryResult = searchService.Execute(q, queryExec, operationOptions);

            QueryStatus queryStatus = queryResult.QueryStatus;
            RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0];
            if (repStatusInfo.Status == Status.FAILURE)
            {
                Console.WriteLine(repStatusInfo.ErrorTrace);
                throw new Exception("Query failed to return result.");
            }
            Console.WriteLine("Query returned result successfully.");

            // print results
            Console.WriteLine("DataPackage contains " + queryResult.DataObjects.Count + " objects.");
            foreach (DataObject dataObject in queryResult.DataObjects)
            {
                Console.WriteLine(dataObject.Identity.GetValueAsString());
            }
        }
    protected void HandleInput(string source)
    {
        List <string> x;
        List <string> y;
        List <string> z;
        List <string> umin = ExpressionParser.Parse("");
        List <string> umax = ExpressionParser.Parse("");
        List <string> tmin = ExpressionParser.Parse("");
        List <string> tmax = ExpressionParser.Parse("");
        List <string> vmin = ExpressionParser.Parse("");
        List <string> vmax = ExpressionParser.Parse("");
        List <string> wmin = ExpressionParser.Parse("");
        List <string> wmax = ExpressionParser.Parse("");

        ExpressionSet expressionSet = densManager.es;

        switch (source)
        {
        default:
            x    = ExpressionParser.Parse("0");
            y    = ExpressionParser.Parse("0");
            z    = ExpressionParser.Parse("0");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("0");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("0");
            print("unknown preset pressed");
            break;

        // Orbitals
        case "1S":
            x = ExpressionParser.Parse("(1.772454*e^(-1*(x^2+y^2+z^2)^(1/2)))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(3);
            densManager.setSleepInterval(126);
            break;

        case "2S":
            x = ExpressionParser.Parse("(0.099735*(2-(x^2+y^2+z^2)^(1/2))*e^(-1*((x^2+y^2+z^2)^(1/2))/2))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(10);
            densManager.setSleepInterval(63);
            break;

        case "2Pz":
            x = ExpressionParser.Parse("(0.099735*z*e^(-1*((x^2+y^2+z^2)^(1/2))/2))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(12);
            densManager.setSleepInterval(63);
            break;

        case "3S":
            x = ExpressionParser.Parse("(0.004021*(27-18*(x^2+y^2+z^2)^(1/2)+2*(x^2+y^2+z^2))*e^(-1*((x^2+y^2+z^2)^(1/2))/3))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(20);
            densManager.setSleepInterval(42);
            break;

        case "3Pz":
            x = ExpressionParser.Parse("(0.004925*(6-(x^2+y^2+z^2)^(1/2))*z*e^(-1*((x^2+y^2+z^2)^(1/2))/3))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(22);
            densManager.setSleepInterval(63);
            break;

        case "3Dz\x00B2":
            goto case "3Dz2";

        case "3Dz2":
            x = ExpressionParser.Parse("(0.002844*(3*z^2-(x^2+y^2+z^2))*e^(-1*((x^2+y^2+z^2)^(1/2))/3))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(24);
            densManager.setSleepInterval(63);
            break;

        case "3Dxy":
            x = ExpressionParser.Parse("(0.009850*x*y*e^(-1*((x^2+y^2+z^2)^(1/2))/3))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(24);
            densManager.setSleepInterval(63);
            break;

        case "4S":
            x = ExpressionParser.Parse("(0.006965*(1-0.75*(x^2+y^2+z^2)^(1/2)+0.125*(x^2+y^2+z^2)-0.005208*(x^2+y^2+z^2)^(3/2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(30);
            densManager.setSleepInterval(42);
            break;

        case "4Pz":
            x = ExpressionParser.Parse("(0.039424*(1-0.25*(x^2+y^2+z^2)^(1/2)+0.0125*(x^2+y^2+z^2))*z*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(34);
            densManager.setSleepInterval(42);
            break;

        case "4Dz\x00B2":
            goto case "4Dz2";

        case "4Dz2":
            x = ExpressionParser.Parse("(0.002204*(3*z^2-0.25*z^2*(x^2+y^2+z^2)^(1/2)-(x^2+y^2+z^2)+0.083333*(x^2+y^2+z^2)^(3/2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(21);
            break;

        case "4Dxy":
            x = ExpressionParser.Parse("(0.003817*x*y*(1-0.083333*(x^2+y^2+z^2)^(1/2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(42);
            break;

        case "4Fz\x00B3":
            goto case "4Fz3";

        case "4Fz3":
            x = ExpressionParser.Parse("(0.000082*z*(5*z^2-3*(x^2+y^2+z^2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(63);
            break;

        case "4Fxz\x00B2":
            goto case "4Fxz2";

        case "4Fxz2":
            x = ExpressionParser.Parse("(0.000101*x*(5*z^2-(x^2+y^2+z^2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(63);
            break;

        case "4Fxyz":
            x = ExpressionParser.Parse("(0.000636*x*y*z*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(63);
            break;
        }

        expressionSet.AddExpression("X", x);
        expressionSet.AddExpression("Y", y);
        expressionSet.AddExpression("Z", z);
        expressionSet.AddRange("t", tmin, tmax);
        expressionSet.AddRange("u", umin, umax);
        expressionSet.AddRange("v", vmin, vmax);
        expressionSet.AddRange("w", wmin, wmax);
        densManager.PresetPressed();
    }